Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Qty By Attribute (Beating a Dead Horse?)

    I realize the general topic of qty by attribute has been kicked around a bit, but I saw a mod or two that were concerned with inventory control.
    What I am looking for is allowing the customer to choose attribute qty such as,

    fruit basket
    small $25
    large $45
    X QTY choc covered apple slices +$1.50 each
    x QTY choc covered strawberries +$1.50 each

    My client even wants to vary the type of chocolate such as light, dark, or Resses Peanut Butter and Chocolate.

    Do the existing mods handle this, or part of this? Am I looking in the right direction?

    Thanks, TecBrat.

  2. #2
    Join Date
    Mar 2006
    Posts
    199
    Plugin Contributions
    0

    Default Re: Qty By Attribute (Beating a Dead Horse?)

    I *think* the regular attributes area under the admin can handle that...you can add a ton of them and set a base price then with certain options +1.00 etc. As long as you don't need it to keep track of stock...that feature is not available yet but is supposed to be planned for the next release.
    Zen Cart: Diva Knitting

  3. #3
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Re: Qty By Attribute (Beating a Dead Horse?)

    Quote Originally Posted by cherylkemp
    I *think* the regular attributes area under the admin can handle that...you can add a ton of them and set a base price then with certain options +1.00 etc. As long as you don't need it to keep track of stock...that feature is not available yet but is supposed to be planned for the next release.
    I could have a dropdown like

    1 dark choc apple slice +1.50
    2 dark choc apple slices +3.00
    .
    .
    .
    10 dark choc apple slices +15.00

    and another like

    1 milk choc apple slice +1.50
    2 milk choc apple slices +3.00
    .
    .
    .
    10 milk choc apple slices +15.00

    and so on, but that begins to look bad. Better if my client's customer can type a quantity for the dark choc, and a quantiy for the milk etc. Any suggestion are greatly welcome!
    thanks.

  4. #4
    Join Date
    Mar 2006
    Posts
    199
    Plugin Contributions
    0

    Default Re: Qty By Attribute (Beating a Dead Horse?)

    If you go to the options value section under catalog...you can choose the way the attributes appear...raido, dropdown, text, etc. The easiest to find out how it would all look it to just play around with it a bit. Create the product (choose price by attribute), name your options and then add attributes to the product.
    Zen Cart: Diva Knitting

  5. #5
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Re: Attribute Quantity Pricing

    This is how I solved it. Any simpler or cleaner solutions would be appreciated by the community.

    Read carfully and you'll get the understanding of how this works, (see end for more)

    in admin/attributes_controller.php
    find
    Code:
    $attributes_price_letters = zen_db_prepare_input($_POST['attributes_price_letters']);
    in 2 places and replace with
    Code:
    $att_price_let=$_POST['attributes_price_letters'];
    $att_qty_price=$_POST['att_qty_price'];
    if (isset($att_qty_price)){$att_price_let=10000 + $att_qty_price;}
    $attributes_price_letters = zen_db_prepare_input($att_price_let);
    in 2 places find
    Code:
    <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_LETTERS . ' ' . TABLE_HEADING_ATTRIBUTES_PRICE_LETTERS_FREE; ?><br />&nbsp;<input type="text" name="attributes_price_letters" value="<?php echo $attributes_values->fields['attributes_price_letters']; ?>" size="6">&nbsp;&nbsp;<input type="text" name="attributes_price_letters_free" value="<?php echo $attributes_values->fields['attributes_price_letters_free']; ?>" size="6">&nbsp;</td>
    and put
    Code:
    <!--  Attribute Qty Price will actually mock up a Text attribute. -->
    <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo 'Attribute Qty Price <br />'; ?><input type="text" name="att_qty_price" size="6"></td>
    under it.
    ----------

    in *yourcart*/includes/functions/functions_prices.php

    find
    Code:
    // calculate letters price
      function zen_get_letters_count_price($string, $free=0, $price) {
          $letters_price = zen_get_letters_count($string, $free) * $price;
          if ($letters_price <= 0) {
            return 0;
          } else {
            return $letters_price;
          }
      }
    and replace with
    Code:
    // calculate letters price or att qty price
      function zen_get_letters_count_price($string, $free=0, $price) {
          if ($price>10000)
           {
            $attqtyprice='flagged';
            $price=$price-10000;
           }
           $count_letters=zen_get_letters_count($string, $free);
           if ($attqtyprice=='flagged'){$count_letters=$string;} // allows a text box to be used to select a certain
                                                                  // number of an attribute like 2 extra widgets.
                                                                  // a bit of a hack job, but it should work.
           $letters_price = $count_letters * $price;
          if ($letters_price <= 0) {
            return 0;
          } else {
            return $letters_price;
          }
      }
    and in *yourcart*/includes/modules/pages/product_info/main_template_vars_attributes.php

    find
    Code:
    //$tmp_html .= TEXT_PER_LETTER . $currencies->display_price($products_options->fields['attributes_price_letters'], zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ($products_options->fields['attributes_price_letters_free'] !=0 ? TEXT_LETTERS_FREE . $products_options->fields['attributes_price_letters_free'] : '');
    and replace with
    Code:
    //for display only
    $txtprltr=TEXT_PER_LETTER;
    $displayperlettercost=$products_options->fields['attributes_price_letters'];
    if ($displayperlettercost > 10000) {$displayperlettercost=$displayperlettercost-10000;
                                                            $txtprltr= "Price Each:";
                                                          }
    $tmp_html .= "$txtprltr ". $currencies->display_price($displayperlettercost, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ($products_options->fields['attributes_price_letters_free'] !=0 ? TEXT_LETTERS_FREE . $products_options->fields['attributes_price_letters_free'] : '');

    When adding an attribute that uses this script, create it as a text attribute. When applying the attribute, look next to the per letter and per word prices and you'll find the new box. when you edit an existing att qty priced item, you will find a $10000.00+ price in the per-letter box. Just delete it and edit the Attribut Per Quantity Price as needed. If for some reason, there was a need to have an actual text attribute with a per letter price greater than $10000.00, one would have to put in a price $10000.00 greater than the actual price.

 

 

Similar Threads

  1. Jquery beating up CSS MENU...HELP!
    By sonik_fury in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 13 Jan 2011, 07:55 AM
  2. ATTRIBUTE with Qty discounts
    By d1rage5 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 15 Jan 2009, 03:57 PM

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