You are here:  » Product Title

Active Forum Topics


Product Title

Submitted by magnaromagna on Sat, 2021-01-09 20:43 in

Hi,
after setting up title product under wp-admin/options-general.php?page=pto as
"price for %PRODUCT_NAME%%IF_REVIEW% Reviews%ENDIF_REVIEW% "

and [pto] inserted into page /catalogue

I see that every product show
"price for [name of product] | [catalogue] | [name of website]"

Is it possible to change into:
"price for [name of product] | %category%"

?

p.s.
I'm using hierarchy categories.

Thank you as usual

Submitted by support on Mon, 2021-01-11 09:35

Hi,

Sure, the category name can be obtained from the categories hierarchy table using $pto_productResults[0]->categoryid so if you edit pto.php and look for the following code at line 656:

    $content = $title." | ".($content?$content:(isset($post)?$post->post_title." | ":"").get_bloginfo("name"));

...and REPLACE with:

    if (($pto_module == "product") || ($pto_module == "review"))
    {
      $content = $title;
      $sql = "SELECT name FROM `".$pto_config_databaseTablePrefix."categories_hierarchy` WHERE id='".esc_sql($pto_productResults[0]->categoryid)."'";
      if ($wpdb->query($sql))
      {
        $row = $wpdb->last_result[0];
        $content .= " | ".$row->name;
      }
    }
    else
    {
      $content = $title." | ".($content?$content:(isset($post)?$post->post_title." | ":"").get_bloginfo("name"));
    }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by magnaromagna on Mon, 2021-01-11 16:24

Perfect, thank you!