Jump to content

Product Timestamp Constantly Updating


Dirty Butter

Recommended Posts

This has been going on for some time on a clean install v5.0.5 and a v4x upgrade to v5.0.5 site. Something is triggering the timestamp to update on each product over and over again. It cycles through all the products repeatedly. I'm afraid if I don't find a way to stop this soon my host will holler, not to mention the fact that it slows everything down! I've included a screenshot, so you can see what I mean.

Can someone suggest what could be causing this and how to fix it?

Link to comment
Share on other sites

  • 3 weeks later...

This has been going on for some time on a clean install v5.0.5 and a v4x upgrade to v5.0.5 site. Something is triggering the timestamp to update on each product over and over again. It cycles through all the products repeatedly. I'm afraid if I don't find a way to stop this soon my host will holler, not to mention the fact that it slows everything down! I've included a screenshot, so you can see what I mean.

Can someone suggest what could be causing this and how to fix it?

I still need help with this, but I have discovered that I can stop the constant updating IF I rename the Popularity column in the _inventory table so that it's disabled. I've tried both the Views and Number of Sales settings for Popularity in General Settings, and neither one makes a difference.

Link to comment
Share on other sites

Well, what I see is that the CubeCart_inventory.updated column in your screen capture shows times that vary from 19:08 to 19:19. If all products were updating simultaneously, all records would have the same time (max one second difference). So, I think that between 19:08 and 19:19, all of your products were viewed. In viewing each product, the popularity column gets updated. That said...

When the CubeCart table was created, the `updated` column took on the properties "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP". That means everytime the record gets updated, this value gets updated regardless. But recall that I said not all of your products, that is to say, not the entire table, is updated in one big bang. Only the record being updated to show an increase in one for the popularity when viewed (as well as actually being updated in the admin screen).

I think what you want is to have the `updated` column only change under the admin update screen. Or, you can just ignore it. I would not rename any column. In many MySQL installations, a missing column should throw an error.

ALTER CubeCart_inventory MODIFY updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP

This will put the timestamp on newly created records, but not when updated.

Then, in the file \admin\sources\products.index.inc.php (make a backup), at about line 83:

if ($GLOBALS['db']->update('CubeCart_inventory', $record, array('product_id' => $_POST['product_id']), true)) {

Add above it:

$record['updated'] = 'CURRENT_TIMESTAMP';

This is just a wild guess! I am only looking at the CC5 code. I don't have a CC5 store up and running. Use at your own risk!

Link to comment
Share on other sites

Well, what I see is that the CubeCart_inventory.updated column in your screen capture shows times that vary from 19:08 to 19:19. If all products were updating simultaneously, all records would have the same time (max one second difference). So, I think that between 19:08 and 19:19, all of your products were viewed. In viewing each product, the popularity column gets updated. That said...

When the CubeCart table was created, the `updated` column took on the properties "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP". That means everytime the record gets updated, this value gets updated regardless. But recall that I said not all of your products, that is to say, not the entire table, is updated in one big bang. Only the record being updated to show an increase in one for the popularity when viewed (as well as actually being updated in the admin screen).

I think what you want is to have the `updated` column only change under the admin update screen. Or, you can just ignore it. I would not rename any column. In many MySQL installations, a missing column should throw an error.

ALTER CubeCart_inventory MODIFY updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP

This will put the timestamp on newly created records, but not when updated.

Then, in the file \admin\sources\products.index.inc.php (make a backup), at about line 83:

if ($GLOBALS['db']->update('CubeCart_inventory', $record, array('product_id' => $_POST['product_id']), true)) {

Add above it:

$record['updated'] = 'CURRENT_TIMESTAMP';

This is just a wild guess! I am only looking at the CC5 code. I don't have a CC5 store up and running. Use at your own risk!

Thanks for your suggestions!

I didn't mean to make it sound like they were all updating in one fell swoop. But there was constant updating in a rolling fashion going on all the time.

I tried Popular Products set to Sales, but that didn't stop the updating, so it's not just a Views issue. I did have lots of error messages with my column rename when it was set to Popularity by View.

So I set Popularity to Sales, set the attribute ON UPDATE back on _updated, and left the Publicity column mislabeled. It's quit doing the rolling updating, and I'm not getting error messages, either.

I can do without the Popularity aspect, but I DO need to have the correct date of when I make a change to the listing.

Link to comment
Share on other sites

  • 1 month later...

I put the _popularity table back to regular name and tried your suggestion by taking off the ON UPDATE in updated column in _inventory. Then added your line above line 83, and all seems to be working as it should. It does update if I change something in Admin, but not when a bot views the listing. THANKS AS ALWAYS!!

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...