©2006-2017 IAAI Software

Contact Us Privacy Policy

Hyphenated URL's for custom 'breadcrumb' in Product page

Submitted by nanaz on Wed, 2017-10-11 14:46.

Hi David,

Hope you are well! In PTO 3.0 I would like to add a custom 'breadcrumb' in the Product page with links to category, brand and custom field(s).

I'm using the existing %DB_myfield% and added the code to be able to use %DBH_myfield% as a proper hyphenated url as described in https://www.pricetapestry.org/node/420.

WP code would be something like:

<p class="pto_pmr"><a href="/gender/%DBH_gender%/">%DB_gender%</a>
&gt;
<a href="/brand/%DBH_brand%/">%DB_brand%</a></p>

Both %DB_myfield% are okay, but the DBH field is not recognized/declared. What am I doing wrong?

Hope you can help and thank you as always,

Marlies

Submitted by support on Thu, 2017-10-12 09:08.

Hello Marlies,

The modification from node 420 only applies to the Prices / Each template. To do the same for Product / Main edit pto_product.php and look for the following code at line 528:

    $html .= $html_product;

...and REPLACE with:

    if (strpos($html_product,"%DBH_"))
    {
      preg_match_all('/%DBH_(.*)%/U',$html_product,$matches);
      foreach($matches[1] as $field)
      {
        $html_product = str_replace("%DBH_".$field."%",pto_common_hyphenate($product->$field),$html_product);
      }
    }
    $html .= $html_product;

Your template code above should then work fine!

Cheers,
David.
--
PriceTapestry.com

Submitted by nanaz on Thu, 2017-10-12 09:40.

Thank you David!