You are here:  » Back button


Back button

Submitted by wesse249 on Sat, 2015-06-27 08:40 in

Hello David,

When a customer comes to my website he mostly comes from Google and is landing on a product page.

Is it possible when he's on the product page he can click o a link and then goes to the category where that product is placed in?

Under the price on a product page i have a button. Here i'd like to have it.

This is the code:

    <div class='small-8 medium-4 columns'>
  <div class='show-for-small-only'>
   <td class='pt_pr_visit'><a class='button tiny radius success' href='<?php print tapestry_buyURL($product_main); ?>'>Meer informatie</a></td>
  </div><img alt='<?php print translate("Image of"); ?> <?php print htmlspecialchars($product_main["name"],ENT_QUOTES,$config_charset); ?>' src='<?php print htmlspecialchars($product_main["image_url"],ENT_QUOTES,$config_charset); ?>' /></div>

Thanks Jan roel

Submitted by support on Sat, 2015-06-27 10:13

Hello Jan,

Sure - the following code will make a link to the product's category results:

<?php if ($product_main["category"]): ?>
<a href='<?php print $config_baseHREF."category/".tapestry_hyphenate($product_main["category"]);?>'>
More from <?php print $product_main["category"]; ?>
</a>
<?php endif; ?>

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Sat, 2016-01-09 19:36

Hello David,

I'm using category hierarchy mapping. When i map a product to a different category the wrong category is showed with this code:

<?php if ($product_main["category"]): ?>
<a href='<?php print $config_baseHREF."category/".tapestry_hyphenate($product_main["category"]);?>'>
More from <?php print $product_main["category"]; ?>
</a>
<?php endif; ?>

Do you have an solutions?

Thank you.

Submitted by support on Mon, 2016-01-11 09:09

Hello Jan,

I know you like to display the most-sub category name only so this can be easily picked up from the categories_hierarchy table and overwrite the "category" field in the product record for display with your existing code. In html/products.php look for the following code at line 2:

  $product_main = $product["products"][0];

...and REPLACE with:

  $product_main = $product["products"][0];
  if ($product_main["categoryid"])
  {
    $sql = "SELECT name FROM `".$config_databaseTablePrefix."categories_hierarchy` WHERE id='".database_safe($product_main["categoryid"])."'";
    database_querySelect($sql,$rows);
    $product_main["category"] = $rows[0]["name"];
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by wesse249 on Mon, 2016-01-11 20:15

Hello David,

Now i get this error:

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in database.php on line 43

Sorry for asking but did you see also my other questions?

Thank you very much.

Submitted by support on Tue, 2016-01-12 09:24

Hello Jan,

categoryid in the $sql construction should have been id - corrected above.

I've got your email thanks - will be checking that out today for you...

Cheers,
David.
--
PriceTapestry.com