If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Can't get added fields to show on product page when I could in version 1.3.9h

Can't get added fields to show on product page when I could in version 1.3.9h

Started by lruskauff on 23 Jan 2014, 4:47 AM · Views: 1,364

Results 1 to 7 of 7
23 Jan 2014, 4:47 AM
#1
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Can't get added fields to show on product page when I could in version 1.3.9h

Hello
I am still working on my upgrade and enjoying what Ive learned. But I am stumped on this one. There are basically 2 files that I know I have an error in and I can't figure which one. Like others, I don't know php but learn from doing. I'm not getting errors, it just isn'[t showing me my fields.

  1. includes/modules/pages/product_info/main_template_vars.php

Here I added my new fields to the sql call:
$sql = "select p.products_id, pd.products_name,

              pd.products_description, p.products_model,

              p.products_quantity, p.products_image,
              pd.products_url, p.products_price,
              p.products_tax_class_id, p.products_date_added,
              p.products_date_available, p.manufacturers_id, p.products_quantity,
              p.products_weight, p.products_priced_by_attribute, p.product_is_free,
              p.products_qty_box_status,
              p.products_quantity_order_max,
              p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter,
			  p.products_kind, p.products_designer, p.products_collection, p.products_color, p.products_content,			  
			  p.products_subtype, p.products_theme, p.products_size, p.products_width, p.products_length,
             p.products_ebay_title, p.products_upc

$product_info = $db->Execute($sql);
(I think the above line is where product_info gets filled by the current product from the database)

  1. Then I notices that below this, the code sets up variables (not sure if correct name) for each of the fields, like:

            $products_weight = $product_info->fields['products_weight'];
    

and since I need my $product_fields defined, I added

$products_designer = $products_info->fields['p.products_designer'];
$products_collection = $products_info->fields['products_collection'];
$products_theme = $products_info->fields['products_theme'];
$products_color = $products_info->fields['products_color'];
$products_content = $products_info->fields['products_content'];
$products_width = $products_info->fields['products_width'];
$products_kind = $products_info->fields['products_kind'];

  1. Then, over in /includes/templates/MYTEMPLATE/templates/tpl_product_info_display.php is the code for displaying on the page. I removed what I did for version 1.3.9h because it didn't work with the way 1.5.1 is written.

Here I added:

<?php echo (("hi") . ("hi") . '</li>') ?> <?php echo ((TEXT_PRODUCT_DESIGNER) . $products_designer) . "\n"; ?> <?php echo ((TEXT_PRODUCT_COLLECTION) . $products_collection ) . "\n"; ?> <?php echo ((TEXT_PRODUCT_THEME) . $products_theme ) . "\n"; ?> <?php echo ((TEXT_PRODUCT_COLOR) . $products_color ) . "\n"; ?>

and I get (the hi was for seeing if I made it to this file):
Manufactured by: Kaufman
hihi Designer: Collection: Theme: Color:

I just can't get it to spit our $products_designer and the other fields. I added the constants to my english php and they show up but I could use some help this time getting the fields to show up.

I scanned the forum for ideas and will continue to do so but any help would be great.

Thanks
Linda

PHP version 5.3.28
MySQL 5.5.32-31.0-log

PS: If anyone knows of a good PHP manual, please share.
Manufactured by: Kaufman
hihi Designer: Collection: Theme: Color:

So I assume that $products_designer and my other new fields are not getting set correctly or they are getting ov
and since they use these fields in the file that displays them I added fields for my code:

23 Jan 2014, 5:06 AM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Can't get added fields to show on product page when I could in version 1.3.9h

Have a peek at the code for Twitch List Price or Twitch Hidden Searchable Model Number, and you'll see which files, SQL queries and php/html needs to be changed to add **your **new fields to v1.51. You're not far off :)

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

23 Jan 2014, 5:31 AM
#3
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: Can't get added fields to show on product page when I could in version 1.3.9h

Just a quick glance at the files they all look like the ones I've used. I can display and edit them in the admin area, just not on the product page where the customer see's them. Do I get another hint please :)

23 Jan 2014, 6:14 AM
#4
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Can't get added fields to show on product page when I could in version 1.3.9h

Here's a cut and paste crash course on the new list_price field from the install instructions,

NOTE: This is NOT a step by step instruction manual, just the highlights to help get your field working :)
**
Start by adding the new field to the database...**

SQL Update:
ALTER TABLE products ADD products_list_price DECIMAL(15,2) NOT NULL DEFAULT '0.00';**

Set the list_price...**
admin/includes/modules/product/collect_info.php
line 21
'products_list_price' => '',
line 51
p.products_image, p.products_price, p.products_list_price,

Show the input field...
line 353 - after products price gross

<tr bgcolor="#66cc00"> <td class="main"><?php echo TEXT_PRODUCTS_LIST_PRICE; ?></td> <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_list_price', $pInfo->products_list_price); ?>Suggested list price</td> </tr>

Define new variable name...
admin/includes/languages/english/product.php
add in line 100
define('TEXT_PRODUCTS_LIST_PRICE', 'Products List Price:');

Pass the list_price data...
admin/includes/modules/product/preview_info.php
line 20
p.products_model, p.products_image, p.products_price, p.products_list_price, p.products_virtual,

Set the list_price value...
admin/includes/modules/update_product.php
line 26
$tmp_value = zen_db_prepare_input($_POST['products_list_price']);
$products_list_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
line 40
'products_list_price' => $products_list_price,
**
SQL search and define the new field...
**includes/modules/pages/product_info/main_template_vars.php
line 44
pd.products_url, p.products_price, p.products_list_price,
line 64
$products_list_price =$product_info->fields['products_list_price'];

Add some CSS styling...
includes/templates/YOUR_TEMPLATE/css/stylesheet.css
line 722 or so - this makes the product info page display the list price in a dark blue colour.
.productsList_price {
font-size: 1.3em;
color:#00367F;
}

Display on product info page...
includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php
line 74
<span class="productsList_price">List Price: $<?php ec**ho $products_list_price; ?>**</span>

Check to make sure the data you enter in admin is actually recorded in the DB, then look on the live site.

If that doesn't work, follow the instructions to install the module, just replace every instance of products_list_price and PRODUCTS_LIST_PRICE with **your **new field name.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

23 Jan 2014, 6:36 AM
#5
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: Can't get added fields to show on product page when I could in version 1.3.9h

Thank you for your help. Those were the steps that I took (and just retook), so at least I know I''m close. I checked the database and the new data is in there. I cut and pasted your display line and it still didn't work. So I think I need to go to bed and I'm sure it will pop out at me in the morning. It has to be something tiny that I'm staring at. I will let you know. Linda

23 Jan 2014, 9:30 PM
#6
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Re: Can't get added fields to show on product page when I could in version 1.3.9h

lruskauff:

Thank you for your help. Those were the steps that I took (and just retook), so at least I know I''m close. I checked the database and the new data is in there. I cut and pasted your display line and it still didn't work. So I think I need to go to bed and I'm sure it will pop out at me in the morning. It has to be something tiny that I'm staring at. I will let you know. Linda

This morning I reread your steps and realized it had to be in my syntax in the very last step (display code). So I deleted all of the code (I added about 8 variables) and played with it until I got ONE to work. Then I added the rest in and it was great.

I want to thank you again though for the outline of the steps. I had to page through my notebook to remember where each part was. For anyone new wanting to add a field or two, I'd advise you to print this out (above steps). Then if you search on "adding new fields" you will find a few handy messages where each step is written in more detail.

Thank you again.
Linda
:P:smile:

24 Jan 2014, 7:21 PM
#7
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Can't get added fields to show on product page when I could in version 1.3.9h

I'm glad it's working for you now.

Also a big thank you for your $upport :)

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian