Jump to content

Need Different Metadata for ?page=all


Dirty Butter

Recommended Posts

  • 2 weeks later...

  • Replies 76
  • Created
  • Last Reply

Top Posters In This Topic

The new MEtafix Search Engine tab info is empty again. I recently cleared not only cache, but cleared SQL cache and language cache - could that be the cause? I just tried clearing the SQL and language cache, with no effect on the metadata I had added, so it's more complicated than a simple clear.

Link to comment
Share on other sites

In post #17 above, I wrote:
In the file /classes/config.class.php, we need to fix (in my opinion, this) a bug. In the __construct() and _fetchConfig() functions:

Find:
$array_out = $this->_json_decode($result[0]['array']);
 
Add below it:
foreach($array_out as $key => $val){ if(is_null($this->_json_decode($val))) {continue;} $array_out[$key] = $this->_json_decode($val); } // Github Issue #198

The problem may be that $val could already be an array. In the _json_decode() function, something other than a string will cause problems. So:
In the file /classes/config.class.php, we need to fix (in my opinion, this) a bug. In the __construct() and _fetchConfig() functions:

DO NOT DO THIS!
foreach($array_out as $key => $val){ if(!is_string($val)) {continue;} $array_out[$key] = $this->_json_decode($val); } // Github Issue #198
DO NOT DO THIS
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Well, I DO make backups of the whole database - but I couldn't figure out how to pull out just that part, and I had added products since that backup. SO I put it all back manually. But when I finished I made a copy in cpanel of the whole database, so I'll have a backup I know how to use if that happens again (hopefully never). If you could explain how to extract what I need from my old .sql.gz backup I'd like to learn how to do that, plus I could be sure I put everything back right.

 

At this time I am NOT using this METAFIX. Oops - didn't see your post above. Will try and report.

Link to comment
Share on other sites

Empty again this morning. Maybe these unique lines from the error log will give you some clues:

 

 

[12-Dec-2014 00:25:43 UTC] PHP Warning:  Invalid Security Token in /home3/butter01/public_html/plushcatalog/classes/sanitize.class.php on line 124

[12-Dec-2014 17:19:49 America/Chicago] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #1 is not an array in /home3/butter01/public_html/plushcatalog/classes/cubecart.class.php on line 867

[12-Dec-2014 18:11:13 America/Chicago] PHP Notice:  GD::gdLoadFile - Unknown file type: /home3/butter01/public_html/plushcatalog/images/source/index.php in /home3/butter01/public_html/plushcatalog/classes/gd.class.php on line 75
[13-Dec-2014 01:24:42 UTC] PHP Warning:  Security Warning: Illegal array key "$Path" was detected and was removed. in /home3/butter01/public_html/plushcatalog/classes/sanitize.class.php on line 89
[13-Dec-2014 01:24:42 UTC] PHP Warning:  Security Warning: Illegal array key "$Domain" was detected and was removed. in /home3/butter01/public_html/plushcatalog/classes/sanitize.class.php on line 89
[13-Dec-2014 01:24:42 UTC] PHP Warning:  Security Warning: Illegal array key "$Path" was detected and was removed. in /home3/butter01/public_html/plushcatalog/classes/sanitize.class.php on line 89
[13-Dec-2014 01:24:42 UTC] PHP Warning:  Security Warning: Illegal array key "$Domain" was detected and was removed. in /home3/butter01/public_html/plushcatalog/classes/sanitize.class.php on line 89
[12-Dec-2014 23:41:08 America/Chicago] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #1 is not an array in /home3/butter01/public_html/plushcatalog/classes/cubecart.class.php on line 867
[12-Dec-2014 23:41:32 America/Chicago] PHP Fatal error:  Call to a member function get() on a non-object in /home3/butter01/public_html/plushcatalog/classes/seo.class.php on line 201
[12-Dec-2014 23:45:14 America/Chicago] PHP Fatal error:  Call to a member function get() on a non-object in /home3/butter01/public_html/plushcatalog/classes/seo.class.php on line 201
[13-Dec-2014 12:11:19 UTC] PHP Fatal error:  Call to a member function assign() on a non-object in /home3/butter01/public_html/plushcatalog/classes/language.class.php on line 106
 

Link to comment
Share on other sites

[12-Dec-2014 00:25:43 UTC] is what happens when the browser's back button is pressed and a set of data is POSTed after a prior POSTing, or having more than one window open and attempting to POST from both.

 

[12-Dec-2014 17:19:49 America/Chicago], [12-Dec-2014 23:41:08 America/Chicago] appears to be a statement new to CC5214 and involves the customer not having a billing address at a particular point in the checkout process. This is line 836 in a stock CC5214 cubecart.class.php file. Have you made any edits to this file?

 

[12-Dec-2014 18:11:13 America/Chicago] is because you have a file that is not a recognized image type in the /images/source/ directory.

 

[13-Dec-2014 01:24:42 UTC] are interesting. It could either be a badly configured scanner/robot, or a true bug in the CubeCart code. If you look at the web access log for this time you should be able to determine what the URL was that had these bad keys.

 

[12-Dec-2014 23:41:32 America/Chicago], [12-Dec-2014 23:45:14 America/Chicago] may be caused by PHP shutting down after a Fatal Error, and during shutdown, the SEO->enabled() function called while the Config class has gone missing. This line 196 in a stock CC5213/5214 file. Have you edited the seo.class.php file?

 

[13-Dec-2014 12:11:19 UTC] is the same as the prior errors except the Smarty class has gone missing.

 

I think none of these errors contain a clue to why the extra meta-data is getting lost.

Link to comment
Share on other sites

The [13-Dec-2014 01:24:42 UTC] ones might have to do with a developer's edits, if you don't think it has anything to do with this metadata issue. It's not a mod, but modified code. I'm not positive that's when I started seeing these error messages, but I think his edits caused it.

 

I've looked over and over for the image file type that's causing the error, but no luck. Didn't expect that to be the issue here.

 

I DO have Checkout edited so they don't see any temporary s/h info, so the s/h shows AFTER they have input the actual delivery address.

 

I DO have mod edits in seo.class.php, so my line numbers are different than stock.

	/**
	 * SEO enabled?
	 *
	 * @return bool
	 */
	public function enabled() {
		return $GLOBALS['config']->get('config', 'seo');
	}
Link to comment
Share on other sites

On second thought, while the Config class has gone missing, is a good indicator of a possibility. But this would only happen if the extra meta-data were added at the same time PHP crashed - so that it wouldn't get saved. But once saved it's always saved, unless something comes along and messes up the retrieval.

 

I may ask that you add some diagnostic code to the /classes/config.class.php file for the fix in post #31.

 

I'm also wondering if there is some code that fetches the config array and does not use the Config->__construct() or Config->_fetchConfig() functions. I'll scan for that.

Link to comment
Share on other sites

 

I may ask that you add some diagnostic code to the /classes/config.class.php file for the fix in post #31.

 

Just tell me what to do and I'll try it.

 

 

[13-Dec-2014 01:24:42 UTC] are interesting. It could either be a badly configured scanner/robot, or a true bug in the CubeCart code. If you look at the web access log for this time you should be able to determine what the URL was that had these bad keys.

 

I don't know how to see the web access log, other than what I see in Users online. I can see in Webots in Users Online in Admin that TheFind bot was accessing the store at 01:24

Link to comment
Share on other sites

Just looked, and this same code is also in the estates store error log, which does NOT have the testimonial mod edits I thought might be causing this:

 

[13-Dec-2014 12:20:46 UTC] PHP Warning:  Security Warning: Illegal array key "$Path" was detected and was removed. in /home3/butter01/public_html/dirtybutterestates.com/classes/sanitize.class.php on line 88
[13-Dec-2014 12:20:46 UTC] PHP Warning:  Security Warning: Illegal array key "$Domain" was detected and was removed. in /home3/butter01/public_html/dirtybutterestates.com/classes/sanitize.class.php on line 88
[13-Dec-2014 12:20:46 UTC] PHP Warning:  Security Warning: Illegal array key "$Path" was detected and was removed. in /home3/butter01/public_html/dirtybutterestates.com/classes/sanitize.class.php on line 88
[13-Dec-2014 12:20:46 UTC] PHP Warning:  Security Warning: Illegal array key "$Domain" was detected and was removed. in /home3/butter01/public_html/dirtybutterestates.com/classes/sanitize.class.php on line 88
[13-Dec-2014 09:54:01 America/Chicago] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #1 is not an array in /home3/butter01/public_html/dirtybutterestates.com/classes/cubecart.class.php on line 867
[13-Dec-2014 09:54:29 America/Chicago] PHP Fatal error:  Call to a member function get() on a non-object in /home3/butter01/public_html/dirtybutterestates.com/classes/seo.class.php on line 201
 

Link to comment
Share on other sites

I downloaded the raw access log from cpanel, but it doesn't go back that far, and I didn't have it marked to Archive it.

 

The estates store DOES have the METAFIX Categories tab in use, as well as your Search, Sale Items, and Registration meta settings, but the Categories Metafix is NOT disappearing on that store.

Link to comment
Share on other sites

I'll have to double check that I've kept up with any edits you and others have suggested, plus maybe a mod I didn't buy for the estates store. That store is not our main priority and gets few sales, so it's possible there are other differences. I'll download and run a Compare of the two stores and get back to you. Thanks for bearing with me. Your help is always very appreciated!!

Link to comment
Share on other sites

I have found what I did that erased the metafix data - I made a change to Store Settings. But I must have done something wrong with the debug tracer code you sent me, as nothing shows up there when the data disappeared.

 

These actions did NOT affect the Categories metafix data - adding or removing a category; moving an item from one category to another; creating a new testimonial or deleting it; creating or editing a product listing; changing the Search, Sales Items, or Registration metadata.

Link to comment
Share on other sites

I think I found it. I will have to check to see if, when POSTing from the Store Settings page, is all that data being used as is, or is it being merged into the existing config array.

 

I had hoped it was being merged which allows for extra settings to be added to the general config array from POSTings not on the Store Settings page.

 

But if by POSTing from the Store Settings page, the existing general config array is dumped whole cloth in favor of the POST array, then that could explain it.

 

I'll be back shortly.

Link to comment
Share on other sites

Maybe an earlier version of CC5 did attempt to merge new config data with existing config data. I see:

[code}

$config_old    = $GLOBALS['config']->get('config');

in the settings.index.inc.php file, but it's not used anywhere.

 

The complete config array is replaced by what's POSTed.

 

So, we either make a separate config array for the extra meta-data for PAGE=ALL situations, or we move those fields from admin Categories to Store Settings.

 

Because these fields are more of a general store setting than specifically oriented towards categories (and that only a category list (search, saleitems) will have pagination, which means we don't have to make this more generalized to fit products or documents), I am leaning towards moving the fields to Store Settings.

Link to comment
Share on other sites

These instructions are relative to post #17.

 

From the admin template categories.index.php, remove:

{* NEW *}
    <div id="addl_seo" class="tab_content">
        <h3>Additional page=all {$LANG.settings.title_seo}</h3>
        <fieldset>
            <div><label for="seo_meta_title_all">Additional page=all Meta Title</label><span><input type="text" name="seo[meta_title_all]" id="seo_meta_title_all" class="textbox" value="{$seo_meta_title_all}" /></span></div>
            {* <div><label for="seo_path_all">Additional page=all SEO Path</label><span><input type="text" name="seo[path_all]" id="seo_path_all" class="textbox" value="{$seo_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="seo[meta_description_all]" id="seo_meta_description_all" class="textbox">{$seo_meta_description_all}</textarea></span></div>
        </fieldset>
  </div>
{* NEW *}

In the admin template settings.index.php, add the following to between these two statements near lines 181-182:

  </fieldset>
  <fieldset><legend>{$LANG.settings.title_seo_meta_behaviour}</legend>

resulting in (Note, the new code looks similar to what was removed above, but there are differences):

  </fieldset>
{* 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>
{* NEW *}
  <fieldset><legend>{$LANG.settings.title_seo_meta_behaviour}</legend>

In /admin/source/categories.index.inc.php, remove what was added in post #17 -- but only what was added relative to this one specific file!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...