Page 24 of 28 FirstFirst ... 142223242526 ... LastLast
Results 231 to 240 of 272
  1. #231
    Join Date
    Jul 2011
    Posts
    106
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    So no-one knows?

    Okay maybe this is going in the right direction but not to sure as its not working... so please if anyone knows what I am trying to do here and can see whats wrong, please feel free to jump in.

    Here's what I have put in my includes/modules/MY_TEMPLATE/product_listing.php - (Only the bit in red, the rest is what's there.)
    Code:
    $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    	$product_info = $db->Execute("select p.products_guarantee, p.products_color,
    		  			p.products_display, p.products_dimensions,
    		  			p.products_energy, p.products_spin, p.products_load,
    		  			p.products_frostfree, p.products_autodefrost,
    		  			p.products_fastfreeze, p.products_fridgecapacity,
    		  			p.products_fuel, p.products_lpgoption,
    		  			p.products_hob, p.products_elements,
    		  			p.products_cavities, p.products_oventype,
    		  			p.products_capacityone, p.products_capacitytwo
    				from " . TABLE_PRODUCTS . " p
    				where p.products_status = '1'
    				and   p.products_id = '" . (int)$_GET['products_id'] . "'");
    	if (!empty($product_info->fields['products_guarantee'])) $lc_text .= '<b>Guarantee:<br /></b>' . ' ' . $product_info->fields['products_guarantee'];
            break;
            case 'PRODUCT_LIST_QUANTITY':
            $lc_align = 'right';
            $lc_text = $listing->fields['products_quantity'];
            break;

  2. #232
    Join Date
    Jul 2011
    Posts
    106
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Solution...

    IF YOU WANT TO PLACE YOUR NEW FIELDS INTO YOUR PRODUCT LISTING.
    -here's how...

    1. Open includes/modules/product_listing.php

    2. Add the code in 'Red', the 'Black' code just shows you where I placed mine 'Don't include it!'
    Code:
    $product_info = $db->Execute("select products_guarantee, products_color, products_dimensions
    				from " . TABLE_PRODUCTS . "
    				where products_status = '1'
    				and   products_id = '" . (int)$listing->fields['products_id'] . "'");
    	if (!empty($product_info->fields['products_guarantee'])) $lc_text .= '<div class="productListFields">' . $product_info->fields['products_guarantee'] . '</div>';
            if (!empty($product_info->fields['products_color'])) $lc_text .= '<div class="productListFields">' . $product_info->fields['products_color'] . '</div>';
            if (!empty($product_info->fields['products_dimensions'])) $lc_text .= '<div class="productListFields">' . $product_info->fields['products_dimensions'] . '</div>';
            break;
            case 'PRODUCT_LIST_QUANTITY':
            $lc_align = 'right';
            $lc_text = $listing->fields['products_quantity'];
            break;
    3. Change 'product_guarantee' 'product_color' and 'product_dimensions' to your own names / table columns you have created.

    That's it!

    For styling purposes I have wrapped a <div> around each output with a class (productListFields) which you can remove or rename as you please for your stylesheet.

    Well I hope this is beneficial to someone...

    Jay.

  3. #233
    Join Date
    Jan 2012
    Location
    South West UK
    Posts
    17
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by earmsby View Post
    That's a really good point. I added a new field as described above but may go back at some point (in my copious free time - ha!) and change it to a separate table.
    There's a long thread here so apologies if its been said - but here's a thing - if its in a separate table then it is inaccessible using Apsona ShopAdmin as an import column. Therefore it should really be personal preference, as I now HAVE to add to the main db to get my clients old shop migrated (some fields are missing).

    Great work - it saved my bacon!

  4. #234
    Join Date
    Nov 2010
    Posts
    84
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    I have been able to do everything successfully here. When I added the input field, it does change the value in the database (I checked in myPHP). The problem I am having is when I go back into edit the product, the value that is in the database for that field is not showing what the present value is, just a blank input field. I created a varchar field...I did all of the steps modifyin the collect_info, preview_info and update_product.php files. I did not need to show this on the product listing page as it is strictly a field I want to use when I print my invoices (fyi, each product is to have its own bin number and this will print on the invoice for order pickers).

    Anyone know what may be happening, any help is much appreciated and what a great thread.

  5. #235
    Join Date
    Mar 2014
    Posts
    22
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Sorry if this has been asked already, but I'm not scanning thru this whole thread. What I am wondering due to the fact I don't know php or Zen Cart that well, YET, but in the examples everywhere no one ever says exactly where the sort for "colour" is even coming from. I can't just make something up if it isn't an attribute or something. So my question, is do these extra fields draw from something that was created in the products such as attributes?

  6. #236
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How-To: Add new Properties to your Products

    Extra fields are just that, extra. You only create them when the data you want to handle does not exist anywhere else in the product. If you can handle the data properly with attributes, you don't need an extra field.

  7. #237
    Join Date
    Apr 2011
    Posts
    91
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Ok, I've read all 24 pages, and unless I overlooked a post, it seems that this modification is missing a change to the file that would be configuration>product listing

    I did the mod as listed on the first post by crazy_chris. I have EP4 installed. I was able to import and export my csv text file with my extra fields.

    The only thing left that I can see is to add the lines of code for the extra fields to the file/section that would add it to the configuration>product listing page in admin. Then I could assign sort order values to the extra fields and they *should* appear on the category and single product pages right?

    If so, I need help finding that file, because I simply cannot find it (assuming I'm right).
    Zen Cart 1.5.3, Database Patch Level: 1.5.3
    Server OS: Linux 2.6.32, Database: MySQL 5.5.41
    HTTP Server: Apache, PHP Version: 5.4.37

  8. #238
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by IllusionGuy View Post
    Ok I got it to work using the following code, I hope others find this useful
    Code:
    <?php echo zen_draw_textarea_field('products_YOUR-FIELD-NAME[' . $languages[$i]['id'] . ']', 'soft', '100%', '10', $pInfo->products_YOUR-FIELD-NAME, zen_set_field_length(TABLE_PRODUCTS, 'products_YOUR-FIELD-NAME')); ?>
    I know this was said some time ago, but I am adding a custom field to the products and it needs to be textarea. I have tried the above but the data in the new cusotmfield is just been dropped.

    Please could anyone advise what I am doing wrong? I have set up the product field as 'text' at mySQL
    Debbie Harrison
    DVH Design | Web Design blog

  9. #239
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: How-To: Add new Properties to your Products

    Sounds like you only updated collect_info.php and not also preview_info.php and update_product.php to know to save that data or where to put it.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #240
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by DrByte View Post
    Sounds like you only updated collect_info.php and not also preview_info.php and update_product.php to know to save that data or where to put it.
    Dr, I followed the step by step guide religiously and updated all the pages mentioned. The setup works when its written as an input field, but when I try to set this up as a text area, it disregards the data and nothing is listed.

    I have read that maybe I should set up the new field (called technical Spec) as a separate database table, similar to how product_description is set up, but I don't know freely how to achieve this.
    Debbie Harrison
    DVH Design | Web Design blog

 

 
Page 24 of 28 FirstFirst ... 142223242526 ... LastLast

Similar Threads

  1. change how latest products works or add new box that displays products we select
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 12 Oct 2010, 04:19 PM
  2. shopping cart contents and new properties to the products
    By stitchnkitty in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Nov 2009, 05:50 PM
  3. Replies: 4
    Last Post: 20 Jun 2009, 04:06 PM
  4. !! Please help !! Add new Properties to your Products
    By JohnSquier in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 27 Feb 2008, 05:46 AM
  5. alter and add new product properties
    By jmitton in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Jan 2008, 03:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR