Hello,
I want to add a new field: Publish Date.
I did what this http://www.pricetapestry.com/node/313 topic says but it doesn`t show the date.
What should i do?
Thanks,
Gabriel
Hi Gabriel,
I would keep the same field type as the others - VARCHAR with length 255. You only really need to use the DATE types when doing calculations against those fields in your SQL, which doesn't apply.
If the value is being imported as empty, then the place to look is within the function admin__importRecordHandler($record) in includes/admin.php (starting at line 124).
If everything looks OK, one check you can do is to print out the SQL and then exit the script. Then dump the record and print out the SQL. For example, at the end of the record handler function you have this code:
return ($admin_importProductCount == $admin_importLimit);
Insert the following code immediately before it:
print_r($record); // dump the record - check you can see the publish date
print ($sql); // dump the SQL - check you can see the publish date being set correctly.
exit();
If everything looks OK what you can then do is copy the SQL and paste it into the SQL input box in phpMyAdmin. This will show any error in the SQL, although this is unlikely if products are being imported...
Hope this helps,
Cheers,
David.
I did some mistakes in coding. In sql i had feed_pubdate and in php code field_pubdate.
Now it`s working fine.
Thanks,
Gabriel
Hi Gabriel,
Did you add the new field to your products table using phpMyAdmin or a similar tool. Double check that your modifications all refer to the same variable name, and make sure that you've made all the modifications required - in particular within includes/admin.php in the registration and import record handler functions.
You can test your modifications first by registering a feed with your new field, then using phpMyAdmin to look at the feeds table and check that the feed you registered for publish date is in the database. This will confirm that registration is working. Then, ideally with an empty product database, register and do a trial import of a feed and then look at the products table to see if the new field is being imported.
If everything looks OK to that point, then it is most likely down to the display code. Check that you are using the correct field name in your PHP, for example:
print $product["publishdate"];
(where publishdate is whatever you have called your new field throughout the modifications)
Hope this helps,
Cheers,
David.