Page 19 of 28 FirstFirst ... 91718192021 ... LastLast
Results 181 to 190 of 272
  1. #181
    Join Date
    Nov 2009
    Posts
    59
    Plugin Contributions
    0

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

    Hi

    I actually got mine to work - trial and error again - but thank you for your comments and code.

    Here is the code I am using:

    <?php
    if ($products_measurements != '') {
    ?>
    <div id="productmeasurements" class="productGeneral"><strong>Measurements (in cm): </strong><?php echo $products_measurements; ?></div>
    <?php
    }
    ?>

    <?php
    if ($products_materials != '') {
    ?>
    <div id="productmaterials" class="productGeneral"><strong>Materials: </strong><?php echo $products_materials; ?></div>
    <?php
    }
    ?>

    <?php
    if ($products_maintenance != '') {
    ?>
    <div id="productmaintenance" class="productGeneral"><strong>Maintenance: </strong><?php echo $products_maintenance; ?></div>
    <?php
    }
    ?>

    Now what I am wondering is whether I could put the data from the Measurements into a table ... so it looks like this:

    http://www.gardenfurniturescotland.c...mentstable.jpg

    Hope someone can help me .... you are all brilliant!

    Gillian

  2. #182
    Join Date
    Aug 2006
    Posts
    133
    Plugin Contributions
    0

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

    My table HTML/CSS is awful -- I always have to look at examples -- but my guess is to run two IF statements for each set of data, one IF to write the title and another IF to write the value. Since no titles will be written for empty values and no values written for empty values, the table will shrink and expand appropriately.

    Substitute/use the bits below into/with proper table HTML/CSS and you should be golden.

    TITLES
    <?php
    if ($products_measurements != '') {
    ?>
    <strong>Measurements (in cm): </strong>
    <?php
    }
    ?>

    <?php
    if ($products_materials != '') {
    ?>
    <strong>Materials: </strong></div>
    <?php
    }
    ?>

    <?php
    if ($products_maintenance != '') {
    ?>
    <strong>Maintenance: </strong>
    <?php
    }
    ?>

    VALUES
    <?php
    if ($products_measurements != '') {
    ?>
    <?php echo $products_measurements; ?>
    <?php
    }
    ?>

    <?php
    if ($products_materials != '') {
    ?>
    <?php echo $products_materials; ?>
    <?php
    }
    ?>

    <?php
    if ($products_maintenance != '') {
    ?>
    <?php echo $products_maintenance; ?>
    <?php
    }
    ?>

  3. #183
    Join Date
    Oct 2007
    Location
    Stow on the Wold, in the Cotswolds - England
    Posts
    13
    Plugin Contributions
    0

    Default Filtering on the new fields?

    Thanks to this thread I have successfully added fields to my product file and can maintain and display them.
    But I need to be able to filter on them too.
    By copying the manufacturers box I have added a sidebox for a search on my new colour field which seems to work ok but it never finds any products.
    When I click on one of the colours in the sidebox I get the following url;
    .../index.php?main_page=index&filter_id=colour_id&colour_id=1
    I have a colour_id_filter.php module in /includes/index_filters/ but I'm not sure it is being included.

    Does someone have a checklist for adding a new filter? I am sure I have missed some basic step in the process.

    Any hints from someone who has been down this path before would be very welcome.

    Thanks - Mark
    [FONT="Verdana"]cotsweb.com[/FONT]

  4. #184
    Join Date
    Jan 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: Filtering on the new fields?

    Hi All,

    I hope I'm not hijacking this thread...

    I am working on a new jewelry site (categories: earrings, bracelets, rings, necklaces) for which I want to to specify some custom product attributes which are not choosable by the customer. I want to use these attributes to search and sort the products.

    Let me explain with an example: Some pieces are gold, some are silver, some are plain, some have stones. None of the attributes are mutually exclusive. So, any piece of jewelry could have the attributes <gold, silver, plain, stone>. I want the user to be able to search and/or click on an attribute and display a list of all the products with that attribute. (i.e., "show me all the jewelry with stones" returns a list of all the necklaces, rings, earrings and bracelets with stones). I'm still shaking my head trying to figure out why this isn't a default feature in Zen Cart.

    After looking at all the posts in this thread, I'm considering attacking the problem from a totally different angle:

    1. Install the hidden categories mod (or some version of it). This step may not be entirely necessary.

    2. Create a hidden category called "attributes". (or not hidden if step 1 is skipped).

    3. Create sub-categories for all the attributes <gold>, <silver>, <plain>, <stones>, <animals>

    4. Modify the <new product> page (collect_info.php?) to have a check-box list of these "attributes" sub-categories, checking these sub-categories will automatically link the product into the appropriate sub-categories.

    5. Create a sidebar box to display the "attributes" sub-categories, or just make the "attributes" visible and use the regular side-bar. Voila! Clickable, dynamic, sortable, searchable attributes.


    My thinking in this regard is that it will be:

    a) potentially easier or as easy to implement as the database change methods from post #1
    b) more flexible for my client to add and change attributes on-the-fly
    c) easy to use the category browser to find out which products have which attributes, or which attributes have which products.
    d) easy to search and display the items in these linked categories

    Does anyone think this method might work or not work? I'm new to Zen Cart and don't want to spend a week barking up the wrong tree....

    It sounds like the only real step in all of this is making a "category linker" on the product page.

    I'd appreciate any tips in advance.

    Thanks,
    Damon

  5. #185
    Join Date
    Aug 2006
    Posts
    133
    Plugin Contributions
    0

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

    lunomad, I agree, ZC's attributes feature is less than it should be or is designed more for companies that do not (need or want to) control inventory tightly.

    Ideally, a customer makes a product selection and then chooses attributes, and then the resulting choice has a unique model number that can be used again for that some combination. Back when I setup ZC, I generated model numbers myself for all the combinations but still couldn't get ZC to serve the correct model number given the choice of attributes. Instead, I went with a heavy cross-categorization organizational model that is not for the faint of heart. FWIW, I wanted to use the HiddenCats mod, but I couldn't get it to work in the way at the time (when I knew much less about ZC and hacking its and any mods' PHP files). Not sure even now that I could get ZC attributes to function the way I'd like them to work. Need way more experience for that and will hold out hope for ZC 3.0.

    Good luck in finding something to work for you! And please do let us know of your solution.

  6. #186
    Join Date
    Dec 2009
    Location
    Sarajevo
    Posts
    80
    Plugin Contributions
    0

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

    Quote Originally Posted by crazy_chris View Post
    hi folks,

    this is a little howto add new properties to general products
    (like guarantee time, color, oem-number, compatible models, whatsoever)
    1. think
      decide which new properties you want to add to your products
      (in this example we take guarantee-time (in months) and color)
      .
    2. db manipulation
      open the table "products" in your zencart-database and insert new rows at the end of the table called "products_guarantee" and "products_color"
      ALTER TABLE `zencart_products` ADD `products_guarantee` INT NOT NULL , ADD `products_color` VARCHAR( 32 ) NOT NULL;
      .
    3. edit 'collect_info.php' (in /admin/includes/modules/product/)
      1. at the very beginning there is the variable $parameters set. add your row-names to the end:
        'products_guarantee' => '0', 'products_color' => '' );
        .
      2. just below there is the db-query set [$product = $db->Execute("...]
        add your rows with a 'p.' in front (before the "from ..." part)
        select ......., p.products_guarantee, p.products_color from ....
        .
      3. now you can add the input fields in the product-mask (lets say somewhere around line 450 or so):
        <tr>
        <td class="main">Guarantee Time (in months)</td>
        <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . zen_draw_input_field('products_guarantee', $pInfo->products_guarantee, zen_set_field_length(TABLE_PRODUCTS, 'products_guarantee')); ?></td>
        </tr><tr>
        <td class="main">Color</td>
        <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . zen_draw_input_field('products_color', $pInfo->products_color, zen_set_field_length(TABLE_PRODUCTS, 'products_color')); ?></td>
        </tr>
        .
    4. edit 'preview_info.php' (in /admin/includes/modules/product/)
      somewhere around line 10 is the variable $product set. like in step 3.2 add the new rows with a 'p.' in front just before the 'from'
      select ......., p.products_guarantee, p.products_color from ....
      .
    5. finally, edit 'update_product.php' (in /admin/includes/modules/)
      around line 20 is the $sql_data_array set. add to the last lines before ');' the new rownames.
      $sql_data_array = .......... 'products_guarantee' => zen_db_prepare_input($_POST['products_guarantee']), 'products_color' => zen_db_prepare_input($_POST['products_color']) );
      .
    6. Setup All Done!
      .

      .
      .
      .
      Of course, now we want to display our cool new properties .
      .
    7. edit 'main_template_vars.php' (in /includes/modules/pages/product_info/)
      around line 46 you find the variable $sql set. like in step 3.2 add the new rows with a 'p.' in front just before the 'from'
      select ......., p.products_guarantee, p.products_color from ....
      .
    8. last step: display the new infos
      edit 'tpl_product_info_display.php'
      (in /includes/templates/template_default/templates/)
      now, wherever you want, you can add to the html:
      <?php echo $product_info->fields['products_guarantee']; ?> and <?php echo $product_info->fields['products_color']; ?>

    enjoy!


    ps: now i'm feeling really ############ up : P




    written by chris at linuxuser.at
    Great and very simple tutorial! I have just add few new fields for short time following your instructions from post above. Thanks man

  7. #187
    Join Date
    Jun 2007
    Posts
    474
    Plugin Contributions
    2

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

    Quote Originally Posted by lindasdd View Post
    Anyone think they can make this work so different product details appear on the product listing page(in columns) based on category?

    -lindasdd
    In case anyone is wondering I figured out how to do this. The scenario is - you added a new product field and you added a new column to the product listing page so you can see and sort by that new filed. But, you only want that field to appear based on certain categories.

    So open includes/modules/pages/index/main_template_vars.php (if you can figure out a way to do this with overrides instead I recommend it)

    Find this section:

    Code:
    "$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
      'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
      'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
      'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
      'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
      'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
      'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
    "
    Right before it add your starting if statement, then right after it add your else and then right after that add your new column list.

    So basically it looks like:
    If category = X, show columns ABC, otherwise, show columns ABCD.

    In my case I have:
    Code:
    if ($current_category_id =='92' ){
      $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
      'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
      'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
      'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
      'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
      'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
      'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
    
        } else{
    $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
      'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
      'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
      'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
      'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
      'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
      'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
      'PRODUCT_LIST_CUSTOMCOLUMN' => 8,
    }

  8. #188
    Join Date
    Jul 2009
    Posts
    52
    Plugin Contributions
    0

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

    I would like to use this with the intention of adding new, used or refurbished so that it can be picked up by Google feeder.

    Now I create a Google upload and have to change the condition for each item.

    Will this work to accomplish this goal?

  9. #189
    Join Date
    Sep 2009
    Posts
    71
    Plugin Contributions
    0

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

    Quote Originally Posted by janekbar5 View Post
    Hi
    in my case I wanted to add about 20 .....

    once you take a closer look you gonne now how to do it
    This is exactly what I need but for some reason its not working for me......


    Post #79

  10. #190
    Join Date
    Sep 2009
    Posts
    71
    Plugin Contributions
    0

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

    worked it out with the help of #153 and #145

    Although this is slightly different...

    INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (1201, 'Show My Field', 'PRODUCT_LIST_MYFIELD', '1', 'MYFIELD', 8, 13, NULL, '2006-07-05 13:59:40', NULL, NULL);

    you will need to change the configuration_id for each one

    This was missing. it basically turns your new PRODUCT_LIST_MYFIELD on so you can see it. That is why it wasnt showing up before because it had no configuarion value. Good Helpful thred pointed me in the right direction good to see people sharing information.

    even puts a box in the admin product listing so you can turn it off!
    Last edited by Bikeforce; 17 Mar 2010 at 06:51 PM.

 

 
Page 19 of 28 FirstFirst ... 91718192021 ... 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