Forums / Templates, Stylesheets, Page Layout / How do I add a custom field to my Product Listing Page?

How do I add a custom field to my Product Listing Page?

Locked

Views: 1,857

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
27 Aug 2010, 5:38 AM
#1
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

How do I add a custom field to my Product Listing Page?

I added a custom product field to a product. It all works fine, shows up on product listing page and is search-able.

Here is my question, i want to add the custom field under the image, just like how the description is under the name.

Anyone know how to go about it?

28 Aug 2010, 10:42 AM
#2
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

OK - I need some expert help. I managed to get my custom product fields to appear kinda the way I want but I can't seem to arrange the order they are appearing on the Product Listing. Actually I can't get them to appear on the Product Listing Page only on the Advanced Search Results Page.

right now order is
PRICE, CUSTOM FEILD1, CUSTOM FEILD2, CUSTOM FEILD3, CUSTOM FEILD4,

I just want to move PRICE to the end column but can't figure it out.
:frusty:

Next question is what files do I need to edit to have my Product Listing Page appear like my Advanced Search Result page.

You can see what I have do with the ADVANCED_SEARCH_RESULTS product listing by clicking here.

29 Aug 2010, 11:18 PM
#3
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

Just wanna thank everyone for their input.

putting the model/part# under the image is now complete, i figured it out.

30 Aug 2010, 12:15 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I add a custom field to my Product Listing Page?

What was the solution that you discovered worked for you for this problem? :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Aug 2010, 5:37 AM
#5
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

getting the CUSTOM_FIELD under the image was actually easy and I know nothing but basic hotmail.

so all i did is change the following:

        $lc_text = '<div class="img_box"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a></div>';

to this:

        $lc_text = '<div class="img_box"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a></div>' . $listing->fields['products_custom_field'];
30 Aug 2010, 6:30 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I add a custom field to my Product Listing Page?

Thanks for the details on how to do this ... it's always a great help to others ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Aug 2010, 6:52 AM
#7
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

still not done yet.

I am trying to add a link to a CUSTOM_FIELD

I added right below name/description a custom field for the products category. You can see by using the link above.

I cant figure out how to link to the products category. This is where I am at:

'<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&category_id=' . $listing->fields['category_id_name']) . '">' . ' ' . '</a>';

30 Aug 2010, 7:38 AM
#8
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

I figured that one out.

I changed:

'<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&category_id=' . $listing->fields['category_id_name']) . '">' . ' ' . '</a>';

to this:

'<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $listing->fields['master_categories_id']) . '">' . $listing->fields['products_CUSTOM_FIELD'] . '</a>';

now here is a question?

How do I use the categories name instead of using a CUSTOM_FIELD that hold just that?

Any suggestions?

30 Aug 2010, 1:56 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I add a custom field to my Product Listing Page?

If you want to pull the categories_name ... you have to decide do you want to pull the name of the current categories_id categories_name or the master_categories_id categories_name ...

The difference is ...

In a Product Listing from the Categories navigation, there is a:
$current_category_id

variable for the categories_id ...

But, in a search, there isn't a $current_category_id so you would need to use the $master_categories_id ...

The function is in the functions_lookups.php file:

function zen_get_category_name($category_id, $fn_language_id) {

You might need to tweak the code a bit based on whether or not the $current_category_id exists and if not then you need to use the $master_categories_id ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

31 Aug 2010, 1:07 AM
#10
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

Thanks Ajeh for all you help.

product_listing.php, located in /public_html/includes/modules/YOUR_TEMPLATE

is what i am editing, but the changes are only affecting my advanced_search_result page and not the actual product_listing page. What am i doing wrong?

31 Aug 2010, 2:41 AM
#11
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: How do I add a custom field to my Product Listing Page?

figured it out.

By editing /public_html/includes/modules/YOUR_TEMPLATE/product_listing.php & adding CUSTOM_FIELDS it does change both the Product Listing Page & Advanced Search Result Page.

I had to add

p.custom_field to:
/public_html/includes/index_filters/default_filter.php

in order for the CUSTOM FIELDS to show up on Product Listing Page tho.

Next - if i should start new thread someone let me know?

How do I use use the same TEMPLATE for All Products, New Products, Specials so that the site has a consistency to it?

31 Aug 2010, 1:46 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I add a custom field to my Product Listing Page?

Thanks for posting your solution to this ... :smile:

Yes, it's time for a new thread for your new question ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!