-
custom product field
hi,
i have added a new product field to me products table by following this great post from crazy_chris: http://www.zen-cart.com/forum/showthread.php?t=57924
everything works fine. i am able to edit values from admin and see results on product info page. http://www.zen-cart.com/forum/images/smilies/cool.gif
i need to output this field on the product listing page - have been tryin in vain for a couple of days and have hit a brick wall it seems. must be missing something.
in my custom product_listing.php template i can output any existing product fields with " $listing->fields['products_id']) "
as soon as i try to reference my new field " $listing->fields['products_image_orientation']) " - it fails and outputs nothing. the same syntax works on product info page - no problem.
can anyone point out what i am missing .... a thousand thank you's in advance .....
[as you can see - i wish to store the orientation of my artwork / prints .... i tried initially to just calulate (width divided by height) but could not figure that out so opted to hard code it as a product attribute]
http://www.zen-cart.com/forum/images/smilies/blink.gif
-
Re: custom product field
I too have followed the instructions as found in the link above, and I would like it to show in my product listing. Has anyone found the answer to this question as I really need to get this onto the listing page as soon as possible. No-one seems to be answering any of the questions concerning this issue.
-
Re: custom product field
Does the SQL query for the product listing retrieve the new field's value? You would probably need to edit that before you can use it in the listing.
-
Re: custom product field
What I have done so far is add a field on the product info page called products_delivery which is editable through admin. The database has been altered to allow for the extra field and all shows up on the product info page. I now need this field to be shown on the product listing page in order for the information to be seen by all customers so that they do not complain about delivery dates.
I have downloaded product_listing.php to see if there is anything that is obvious for me to customise but I cannot see where to start. I know that I must pull the information from the database in order for this to be shown, but not quite sure how to do it.
-
Re: custom product field
At the top of product_listing.php, this gets the data to be used:
PHP Code:
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_LISTING, 'p.products_id', 'page');
so you would have to find the file where splitPageResults is built (in a /functions/ or /classes/ folder, most likely) and add to the SQL query there.
-
Re: custom product field
Me no understand!!! Am I to edit the product_listing.php file or some other file? If so where do I find this other file and what do I add?
-
Re: custom product field
I currently have a field set up in my database and the product info page called products_delivery that works well. But I need to be able to display this in the product listing page. Do I add this to the product listing page and how?
-
Re: custom product field
Use the Developers Toolkit in admin > Tools to find the file where splitPageResults is built (see the tutorials if you don't know how to use it yet). That file is most likely the place to modify the SQL query to also retrieve your products_delivery field.
Once you have retrieved it, you can use it in product_listing.php the same way as in the product info page.
-
Re: custom product field
There are lots of places where splitPageResults is found but I cannot see where or what I am supposed to put the info that is needed. There is also a splitPageResults.php file in /includes/classes. Where am I supposed to place products_delivery? Am I also to edit the product_listing.php file with the same info in the splitPageResults section? Is there anywhere else that I am supposed to edit and what am I meant to change?
I appreciate your time and effort in replying to my enquiry, but there are so many questions that are being raised by the answers given that I am not really acheiving anything. I need more specific information in order to get to the results that are needed. I am okish with PHP, good with HTML and useless with SQL, JAVASCRIPT and most other scripts. It is important that any info given doesn't just point me in the right direction, but gives me accurate and precise information about how to include the field that I require in the product_listing page.
If you have not the time or the info please just say and I will appreciate your efforts in helping me.
-
Re: custom product field
I believe /includes/classes/splitPageResults.php will be the file to edit, but I can't tell you definitively how to edit the SQL query.
If you know what you did to get the new field into the product info page, the addition to the SQL should be quite similar if not the same. Be careful about this, as splitPageResults may also be used in other situations where you don't want to change. It may make no difference to other locations if the new field is available and unused there.