Re: How-To: Add new Properties to your Products
Hi
Can you please help. I want to add a new property to the 'extras' fields for product type music. I think its table product_music and I want to add the field 'format'
These additional music fields are maintained via the admin screen 'extra's menu choice.
Thanks for any guidance.
John
Re: How-To: Add new Properties to your Products
I am having a problem with this setup. I added the extra fields, and I can update them & have them show up just fine. I am having trouble getting them to show up on the listings page, where there are multiple products.
I found where the descriptions go (in product_listing.php) but whenever I try to execute a line like this, right before the description, it is always turning up null, even when data is there:
PHP Code:
$c_height = $product_info->fields['products_height']
maybe $product_info can't be accessed from this page, is that the problem? it seems all the other data is getting from an array called $listings. do I need to edit another file to make sure that array can get to the new fields. if so, what file is it, and where do I find it?
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
zep
Jane,
I have modified the files, and Im sorry for such a questions, but....
I am having issues displaying the info in tpl_moduals_featured_products.php
I'm calling calling $case = $product_info->fields['products_case'];
and also tried $case = $featured_products>fields['products_case'];
Im then putting the var into this statement :
<div class="p_left"><br style="line-height:9px;"/>Case Price: <a href="'.$href.'">'.$price.'<br/>'.$case.'<br/>'.$case2.'<br/>'.$case3.' </a>
When I echo, I'm getting no output, so the variable I put it into is empty. Im sorry to seem so needy, but could you lend a tip?
Thanks
Hey Zep, did you get this working, I'm trying to get my custom field to show up in the products_all page and I'm getting the same outcome it's like the field is empty...
This is the code I'm trying to use in the tpl_modules_products_all_listing.php, but it's only showing 0
PHP Code:
if ($product_info->fields['products_on_order']){$products_on_order = $product_info->fields['products_on_order'];}else{$products_on_order = "0";}
echo '<td align="left" width="18%">'.$product_info->fields['products_on_order'].' Units On Order: '.$products_on_order.'</td>';
Any help would be great thanks guys :smile:
Re: How-To: Add new Properties to your Products
Yes I did get this working, I actually combined a different post to use the same template for all the listings (Note: search requires a different template)
http://www.zen-cart.com/forum/showth...single+listing
Its pretty strait forward, then and by adding the new fields to your MySQL queries for the particular display you are calling (new, featured,product), you can include them in your product info array, thus when they are called the information will actually be there:wink:
good luck, if you need another hint, shoot an email
also I used $case = $featured_products>fields['products_case'] the $featured_products query is where you need to add your new fields (use the developers toolkit)
Re: How-To: Add new Properties to your Products
GSto: yes you are correct $product_info is the array that the SQL statement creates for the product info page, see above for the changes you must make for each view you wish to alter.
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
zep
GSto: yes you are correct $product_info is the array that the SQL statement creates for the product info page, see above for the changes you must make for each view you wish to alter.
Awesome, thanks. yeah, I finally got it working. About to try editing the search engine so that it can search by the new attributes.
And thanks to everyone else in this thread that posted lots of helpful information. The boss loved the new look!
Re: How-To: Add new Properties to your Products
I'm having an issue with this mod. I followed all of the beginning steps. I was able to successfully add the custom fields to the database and admin section and have them display for each product.
But I'm wanting to do something like janekbar5 posted in post #66.
http://www.zancart137.may.com.pl/ind...&cPath=3_67_74
I would like my custom fields to show up on the categories page. I also followed this post http://www.zen-cart.com/forum/showth...single+listing like was suggested by zep on post 94. But that didn't accomplish what i wanted.
Are there any other resources that can point me in the direction to get the categories page to display the products in a list with the custom fields like this?
http://www.zancart137.may.com.pl/ind...&cPath=3_67_74
Re: How-To: Add new Properties to your Products
This may be the most helpful post ever.
Re: How-To: Add new Properties to your Products
Okay - I'm trying to add a new DB property to the new products box on the index page...
I have created the DB field and followed all the instructions, and I know it works because I can call my new info from my new table 'products_itemprice' in the main product info.
BUT...
I cannot seem to find out how to replace the standard PRICE displayed in the new products listing on the front page!
I have edited the file /modules/new_products.php to include the relevent DB query here:
<code>
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_itemprice, p.products_price, p.products_date_added, p.products_qty_box_status, product_is_call, products_quantity
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit;
} else {
$new_products_query = "select distinct p.products_id, p.products_image, p.products_itemprice, p.products_tax_class_id, p.products_date_added, p.products_qty_box_status, product_is_call, products_quantity,
p.products_price
from " . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c
where p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id
and c.parent_id = '" . (int)$new_products_category_id . "'
and p.products_status = 1 " . $display_limit;
</code>
I now need to replace the price lookup with my new DB field info - so I tried changing:
<code>
$products_price = zen_get_products_display_price($new_products->fields['products_id']);
</code>
with this
<code>
$products_price = $products->fields['products_itemprice'];
</code>
But obviously my SQL query is pants :(
Any help please?
Re: How-To: Add new Properties to your Products
First many thanks to crazy_chris. After following the instructions, I have my new fields in the products table and am able to add data to them via the admin products panel.
My problem comes when I try to display the new fields in the product_info display.
I have followed the instructions re: adding the field in main_template_vars and tpl_product_info_display.php. I have verified that my additions are correct (no errors being thrown). Yet none of the data from new fields is showing.
I have the main_template_vars in an override directory but have also tried without the override.
The tpl_product_info_display.php is in an override for my custom template.
I have gone through this thread, and some others, but am not finding any answers that explain why my sql queries are not returning data for the new fields (at least this would certainly seem to be the problem). Maybe I am overlooking something obvious.
I am using 1.3.8a
Any advice would be deeply appreciated.