Hello,
I would like to display the date a product is added for the first time to the products table.
I have implemented the UPDATE / INSERT modification (5513 / 6255)
And have added a date field to the database.
When I put this code in admin.php (above create dupe_hash value):
$importRecord["addeddate"] = date('Y-m-d H:i:s');
The date is added. But it updates on every import.
Where do I put the code so it only is used at inserts and/or how can it be ignored on updates?
Best,
Marco
Hi Marco,
This should work - when $importRecordSQL is constructed, `addeddate` is set to the value of $importRecord["addeddate"]. So when the SQL is modified for an UPDATE instead of INSERT, `addeddate` can be set to itself...
So after the INSERT/UPDATE modifications you would have the following code around line 531:
$sql = str_replace($search,$replace,$sql);
...and REPLACE with:
$sql = str_replace($search,$replace,$sql);
$sql = str_replace("`addeddate`='".database_safe($importRecord["addeddate"])."'","`addeddate`=`addeddate`",$sql);
Hope this helps!
Cheers,
David.
--
PriceTapestry.com