Jump to content

Archived

This topic is now archived and is closed to further replies.

Dirty Butter

Need Different Metadata for ?page=all

Recommended Posts

I tried, but I must have done something wrong when I tried to undo the edits originally in #17. The Storefront appears to be working, but as soon as I try to move off the new Search Engines tab in Store Settings I am sent to the storefront homepage.

 

I temporarily put categories.index.inc.php back with all your #17 edits. Storefront shows correct title for page=all in Source Code.

Share this post


Link to post
Share on other sites

I went through the #17 post edits again, and this time I was able to delete the edits with the Admin pages working correctly. I no longer have the Store Search Engines seo metadata listed in the Store Settings Search Engines tab, but the All %x, %Y meta data instead. This works for me, because of our metadata for the Homepage document.

 

Using the code fix provided here works great unless you do not have an enabled Homepage Document with store metadata.

 

I have tried editing the Store Settings and saving, and the %X and %Y data did NOT disappear!!!

 

THANK YOU FOR ALL YOU DO!!!

Share this post


Link to post
Share on other sites

"I no longer have the Store Search Engines seo metadata listed in the Store Settings Search Engines tab."

 

That's not right.

Share this post


Link to post
Share on other sites

I copied back in the original seo store table in Store Settings>Search Engines from settings.index.php, leaving the new page=all table in place as well (probably what I should have done to begin with). It saved the test data I put in it on the Store Settings Search Engines tab into the config table in the database, but it did not use it.

Share this post


Link to post
Share on other sites

Checking today, because Google is again complaining about duplicate metadata for page=all - and sure enough, the Source Code for View All page is not using the %X %Y data, even though it is still in Store Settings. I checked, and the config table still has it. But it also still has the test Store Metadata that is not being used. I tried taking back off the original Store Metadata code from settings.index.php, but that didn't help, either.

 

I post this, NOT to get you busy working on this again, Bsmither, but so anyone else trying to accomplish this metafix and following this thread will know that it is still not "sticking" for me. Hopefully you will find a solution after the New Year, when all the holiday festivities are over.

 

May you and your family have a joyous Christmas!!

Share this post


Link to post
Share on other sites

"the config table still has it. But it also still has the test Store Metadata that is not being used."

 

How are you able to tell that the config table has the additional meta-data strings?

 

And you say the store's meta-data (Browser Title, Meta Description, and Meta Keywords on Store Settings, Search Engines tab) is not being used. You don't see the name of the store in the HTML sent to the browser <title>Browser Title</title>?

Share this post


Link to post
Share on other sites

What is your current state with respect to this project? I am looking at the HTML source of the page delivered when visiting /special-occasions.html?page=all and not seeing anything non-standard.

Share this post


Link to post
Share on other sites

It has to be a category that requires pagination. Try Easter View All and you will see in Source Code the %X %Y part of the metadata is no longer in use.

 

As for how can I tell the store metadata is not being used:

 

I temporarily disabled the Homepage document.

I changed the Store meta data Browser Title to test

Test shows up in the config (decoding the base64)

Cleared Cache

Store then shows the URL as the browser title. Source Code for homepage <title></title>shows no info at all.

 

BUT I REALLY didn't want you working on this now!

Share this post


Link to post
Share on other sites

"It has to be a category that requires pagination."

 

That's not how the modifications to the CubeCart code was supposed to work.

 

I am looking at /easter-plush.html?page=all and not finding anything non-standard.

Share this post


Link to post
Share on other sites

Allow me to confirm with you about instruction in post #17:

 

In the file /classes/catalogue.class.php, in the displayCategory() function:

Find (about 20 lines into the function):
$GLOBALS['seo']->set_meta_data($meta_data);
 
Add above it: <== Make sure to add the following new code above the existing code.
 

/* NEW */
$page = (isset($_REQUEST['page']) && !empty($_GET['page'])) ? $_REQUEST['page'] : 1;

and the rest of the new code.

Share this post


Link to post
Share on other sites

Oh Good Grief!!! I had all the right code, but somehow in testing I guess, I had commented it out!!!!! So the %X %Y is working. I apologize for wasting your time.

 

But the Browser Title still does not work when the Homepage Document is disabled.

Share this post


Link to post
Share on other sites

I'm too frazzled to do this today - the "See all our %Y on one page" is working, but the All Our %X is not. So I must STILL have a mess in the code somewhere. This has to be my fault, so I'll give my brain a rest and try to go through all the code again at another time.

Share this post


Link to post
Share on other sites

The <title> tag is populated by:

* the (seo)name of the document

* the (seo)name of the category

* the (seo)name of the product

* the name of the _a=pagename (register, account, etc)

 

By disabling the Homepage document, there is no longer any document name to use for the <title> tag.

Share this post


Link to post
Share on other sites

So how would I be able to see if the store metadata from the Search Engines tab of Store Settings is being used anywhere?

Share this post


Link to post
Share on other sites

I left it alone for a bit and came back and finally found my error. In post #17 you had changed catelogue.class.php to

Add above it:
/* NEW */
$page = (isset($_REQUEST['page']) && !empty($_GET['page'])) ? $_REQUEST['page'] : 1;
$catsAddlSEO = $GLOBALS['config']->get('config', 'catsAddlSEO');
if(!empty($catsAddlSEO) && $page == 'all'){
    $meta_data['description'] = str_replace('%X',$meta_data['description'],$catsAddlSEO['meta_description_all']);
    $meta_data['description'] = str_replace('%Y',$meta_data['title'],$meta_data['description']);
    $meta_data['title'] = str_replace('%X',$meta_data['title'],$catsAddlSEO['meta_title_all']);
    // $meta_data['title'] = str_replace('%Y',$meta_data['title'],$meta_data['meta_title_all']);
}
/* NEW */

For some reason I had uncommented the line you have commented out. %X and %Y are now working again.

Share this post


Link to post
Share on other sites

"So how would I be able to see if the store metadata from the Search Engines tab of Store Settings is being used anywhere?"

 

On the Store Settings, Search Engines tab, "Product, Category & Document Meta Data" selector, if you choose Merge, then you should see the store's general meta-data included, along with the specific meta-data, in the HTML sent to the browser.

Share this post


Link to post
Share on other sites

I write a custom seo for every possible setting, so I have it set to Replace, not Merge. When I tried Merge it DID include my test. So that makes sense. I couldn't use CubeCart successfully if it weren't for you!!! You must be a very patient person to put up with all my ignorance. THANK YOU!!!

Share this post


Link to post
Share on other sites

I just went through and added the code back into v6.0.2. Since this was such an involved thread, with edits, strike through's, and general confusion on my part, I thought it wise to end with a summary of what appears to be working at this time.

 

settings.index.php addition:

   <div id="Search_Engines" class="tab_content">
      <h3>{$LANG.settings.title_seo}</h3>
 {* BSMITHER PAGE=ALL METADATA NEW *}
 <fieldset><legend>Additional page=all {$LANG.settings.title_seo_meta_data}</legend>
    <div><label for="seo_meta_title_all">Additional page=all Meta Title</label><span><input type="text" name="config[catsAddlSEO][meta_title_all]" id="seo_meta_title_all" class="textbox" value="{$CONFIG.catsAddlSEO.meta_title_all}" /></span></div>
    {* <div><label for="seo_path_all">Additional page=all SEO Path</label><span><input type="text" name="config[catsAddlSEO][path_all]" id="seo_path_all" class="textbox" value="{$CONFIG.catsAddlSEO.path_all}" /></span></div> *}
    <div><label for="seo_meta_description_all">Additional page=all Meta Description<br /><br />%X for existing, %Y for Meta Title<br />
    Example:<br />
    All Meta Title-- <tt>All Our %X</tt><br />
    {* All SEO Path-- <tt>all-our-%X</tt><br /> *}
    All Meta Desc-- <tt>%X See all our %Y on one page.</tt></label><span><textarea name="config[catsAddlSEO][meta_description_all]" id="seo_meta_description_all" class="textbox">{$CONFIG.catsAddlSEO.meta_description_all}</textarea></span></div>
  </fieldset>
{* END BSMITHER PAGE=ALL METADATA NEW *}
{*ORIGINAL SEO SECTION*}
      <fieldset>
         <legend>{$LANG.settings.title_seo_global_meta_data}</legend>

catalogue.class.php addition

			$GLOBALS['smarty']->assign('category', $vars['category']);
			$meta_data = array(
				'name'   => (isset($catData['cat_name'])) ? $catData['cat_name'] : '',
				'path'   => null,
				'description' => (isset($catData['seo_meta_description'])) ? $catData['seo_meta_description'] : '',
				'keywords'  => (isset($catData['seo_meta_keywords'])) ? $catData['seo_meta_keywords'] : '',
				'title'   => (isset($catData['seo_meta_title'])) ? $catData['seo_meta_title'] : '',
			);
/* NEW BSMITHER PAGE=ALL METADATA FIX */
$page = (isset($_REQUEST['page']) && !empty($_GET['page'])) ? $_REQUEST['page'] : 1;
$catsAddlSEO = $GLOBALS['config']->get('config', 'catsAddlSEO');
if(!empty($catsAddlSEO) && $page == 'all'){
    $meta_data['description'] = str_replace('%X',$meta_data['description'],$catsAddlSEO['meta_description_all']);
    $meta_data['description'] = str_replace('%Y',$meta_data['title'],$meta_data['description']);
    $meta_data['title'] = str_replace('%X',$meta_data['title'],$catsAddlSEO['meta_title_all']);
    // $meta_data['title'] = str_replace('%Y',$meta_data['title'],$meta_data['meta_title_all']);
}
/* END  BSMITHER PAGE=ALL METADATA FIX */
			$GLOBALS['seo']->set_meta_data($meta_data);
		} else if ($_GET['_a'] !== 'saleitems') {
				$GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_category_error']);
				return false;
			}

tested on

https://dirtybutter.com/plushcatalog/carters-plush-animals.html?page=all

Source Code looks correct.

 

I have NOT made the edit from #31 shown below in config.class.php. Should I, or has v6 made this unnecessary?

Assuming you have your Store Settings back, try this in the __construct() and _fetchConfig() functions:

// NEW
foreach($array_out as $key => $val){ // Github Issue #198
  if(!is_string($val)){
    continue;
  }
  $array_out_tmp = $this->_json_decode($val);
  $array_out[$key] = !empty($array_out_tmp) ? $array_out_tmp : $val;
}
// NEW


Share this post


Link to post
Share on other sites

Regarding the question about the config class, I would set that aside for now. I think there has not been any changes to the codebase regarding my reason for suggesting this change, as the reason seems to not manifest itself - even though it could from what I see.

Share this post


Link to post
Share on other sites

Long discussion so this is just an observation as I may have picked something up wrong.

 

On V6 the pagination appears to work differently to V5. These doesn't appear to be a link to the View All page so from what I can see you would never get to the URL https://dirtybutter.com/plushcatalog/carters-plush-animals.html?page=all. If you click on the View More link at the bottom of the page until you get to the end then you still stay on https://dirtybutter.com/plushcatalog/carters-plush-animals.html.

 

Assuming this is the case is there any need for additional meta tags? Or am I missing something?

Share this post


Link to post
Share on other sites

You're right, ayz1. As far as I can tell CC no longer creates this page IF the More bar is used, instead of pagination. I tried to be stubborn and put up with no Google traffic, thinking time would solve this craziness. But it was killing our business.

 

The page DOES exist, IF you create it. And somewhere on the internet some site (probably one of the aggregate types) has links being picked up to our store with the ?page=all url's. If you're lucky enough that these page=all pages were never used by some site, then you probably don't need this code fix. But we definitely did.

Share this post


Link to post
Share on other sites

Is it not the case that "More..." (which fetches and appends to existing) is available to Foundation, but any other (current) skin would still use the CC5-style pagination?

Share this post


Link to post
Share on other sites

That's true as well, Bsmither. And pagination is still available on the storefront with Foundation. The code to change from the ajax More bar to pagination is already there, just commented out. This issue is important on our plushcatalog site, because some other website(s?) has links to the category-name?page=all format. Even though Foundation does not by default create it, the link is still good.

Share this post


Link to post
Share on other sites

I'm on 6.0.6, and I'm getting the duplicate warnings on Google again. I double checked, and this code still appears to be correctly in place in mine.

The "All Our %X" and "%X See all our %Y on one page." information is still viewable on the Search Engines tab, but it does NOT show in the Source Code when I look at a lengthy category page.

I'm wondering if this issue cropping up again is in some way related to the fact that the only way I can get https:// sitemap entries to stick after ANY Store Settings change is to delete the standard url entry on the SSL tab and let CC re-populate it.

I just went through and added the code back into v6.0.2. Since this was such an involved thread, with edits, strike through's, and general confusion on my part, I thought it wise to end with a summary of what appears to be working at this time.

 

settings.index.php addition:

   <div id="Search_Engines" class="tab_content">
      <h3>{$LANG.settings.title_seo}</h3>
 {* BSMITHER PAGE=ALL METADATA NEW *}
 <fieldset><legend>Additional page=all {$LANG.settings.title_seo_meta_data}</legend>
    <div><label for="seo_meta_title_all">Additional page=all Meta Title</label><span><input type="text" name="config[catsAddlSEO][meta_title_all]" id="seo_meta_title_all" class="textbox" value="{$CONFIG.catsAddlSEO.meta_title_all}" /></span></div>
    {* <div><label for="seo_path_all">Additional page=all SEO Path</label><span><input type="text" name="config[catsAddlSEO][path_all]" id="seo_path_all" class="textbox" value="{$CONFIG.catsAddlSEO.path_all}" /></span></div> *}
    <div><label for="seo_meta_description_all">Additional page=all Meta Description<br /><br />%X for existing, %Y for Meta Title<br />
    Example:<br />
    All Meta Title-- <tt>All Our %X</tt><br />
    {* All SEO Path-- <tt>all-our-%X</tt><br /> *}
    All Meta Desc-- <tt>%X See all our %Y on one page.</tt></label><span><textarea name="config[catsAddlSEO][meta_description_all]" id="seo_meta_description_all" class="textbox">{$CONFIG.catsAddlSEO.meta_description_all}</textarea></span></div>
  </fieldset>
{* END BSMITHER PAGE=ALL METADATA NEW *}
{*ORIGINAL SEO SECTION*}
      <fieldset>
         <legend>{$LANG.settings.title_seo_global_meta_data}</legend>

catalogue.class.php addition

			$GLOBALS['smarty']->assign('category', $vars['category']);
			$meta_data = array(
				'name'   => (isset($catData['cat_name'])) ? $catData['cat_name'] : '',
				'path'   => null,
				'description' => (isset($catData['seo_meta_description'])) ? $catData['seo_meta_description'] : '',
				'keywords'  => (isset($catData['seo_meta_keywords'])) ? $catData['seo_meta_keywords'] : '',
				'title'   => (isset($catData['seo_meta_title'])) ? $catData['seo_meta_title'] : '',
			);
/* NEW BSMITHER PAGE=ALL METADATA FIX */
$page = (isset($_REQUEST['page']) && !empty($_GET['page'])) ? $_REQUEST['page'] : 1;
$catsAddlSEO = $GLOBALS['config']->get('config', 'catsAddlSEO');
if(!empty($catsAddlSEO) && $page == 'all'){
    $meta_data['description'] = str_replace('%X',$meta_data['description'],$catsAddlSEO['meta_description_all']);
    $meta_data['description'] = str_replace('%Y',$meta_data['title'],$meta_data['description']);
    $meta_data['title'] = str_replace('%X',$meta_data['title'],$catsAddlSEO['meta_title_all']);
    // $meta_data['title'] = str_replace('%Y',$meta_data['title'],$meta_data['meta_title_all']);
}
/* END  BSMITHER PAGE=ALL METADATA FIX */
			$GLOBALS['seo']->set_meta_data($meta_data);
		} else if ($_GET['_a'] !== 'saleitems') {
				$GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_category_error']);
				return false;
			}

tested on

https://dirtybutter.com/plushcatalog/carters-plush-animals.html?page=all

Source Code looks correct.

 

I have NOT made the edit from #31 shown below in config.class.php. Should I, or has v6 made this unnecessary?

Assuming you have your Store Settings back, try this in the __construct() and _fetchConfig() functions:

// NEW
foreach($array_out as $key => $val){ // Github Issue #198
  if(!is_string($val)){
    continue;
  }
  $array_out_tmp = $this->_json_decode($val);
  $array_out[$key] = !empty($array_out_tmp) ? $array_out_tmp : $val;
}
// NEW


 

I was going to check the reference to #31 post to see if any of the config.class.php file had changed in v6.0.6, but I couldn't figure it out. I really NEED to post comment numbers on this forum!!!

Share this post


Link to post
Share on other sites

×
×
  • Create New...