You are here:  » Brand / Merchant intial caps in breadcrumb, h1 & search field


Brand / Merchant intial caps in breadcrumb, h1 & search field

Submitted by Retro135 on Mon, 2015-07-06 02:51 in

Finally making headway, but couldn't figure where I could change these on the brand / merchant pages. This affects the breadcrumb, h1 & search field where I have this code in the header.php:

<?php
 
print(isset($header["title"])?$header["title"]:$config_title); 
?>

brand:Brand Name: > I want to be Brand: Brand Name
merchant:Merchant Name > Merchant: Merchant Name

Examples:
http://www.example.com/shops/brand/10-Crosby-Derek-Lam/
http://www.example.com/shops/merchant/AGiftPersonalized/

Submitted by support on Mon, 2015-07-06 07:44

Hi,

The easiest way to do this would be to do a search and replace of the search operator with the required alternative. In search.php, for the title look for the following code at line 485:

  $header["title"] = $q;

...and REPLACE with:

  $header["title"] = str_replace(array(":","merchant","category","brand"),array("","Merchant: ","Category: ","Brand: "),$q);

Similarly, for the banner / breadcrumb, look for the following code at line 393:

$banner["h2"] = translate("Product search results for")." <strong>".htmlspecialchars($q,ENT_QUOTES,$config_charset)."</strong>&nbsp;";

...and REPLACE with:

$banner["h2"] = translate("Product search results for")." <strong>".htmlspecialchars(str_replace(array(":","merchant","category","brand"),array("","Merchant: ","Category: ","Brand: "),$q),ENT_QUOTES,$config_charset)."</strong>&nbsp;";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Mon, 2015-07-06 13:01

Almost there. The ":" still remains after the Merchant Name & Brand. And the search input field still has the merchant:Merchant Name:, etc. Can't figure out how to change that in the searchform.php input.

http://www.example.com/shops/merchant/AGiftPersonalized/

Submitted by support on Mon, 2015-07-06 13:16

Hi,

I've modified the replacements above to remove the ending ":".

Regarding search form pre-population, ideally this should reflect the actual query (otherwise submitting the form would give unpredictable results), so what I normally suggest is only pre-populating the search form for normal queries. To do this, in html/searchform.php look for the following code within line 13:

<?php print (isset($q)?$q:""); ?>

...and REPLACE with:

<?php print (((isset($q)) && (!isset($parts[1])))?$q:""); ?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Mon, 2015-07-06 13:53

It's all good now, thank you kindly! Tomorrow will start doing categories/subcategories and how to rework my existing pages.

I'm loving PT, it's totally awesome! Much to learn...but is adding so much functionality I didn't have before, such as auto price comparisons, related items, etc. David, thank you for PT and all the fab support you give.

Submitted by support on Mon, 2015-07-06 13:59

Thank you for your comments!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Sun, 2015-07-19 15:20

Trying to carefully upgrade from 15/01 as I've heavily modded it. What do I change in the new 15/09 search.php and searchform.php to fix merchant:Merchant Name:

1. I need to uppercase merchant, brand & category (the code I changed before is no longer there)

2. Insert space after :

3. Remove end :

Thank you kindly!