Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    7
    Plugin Contributions
    0

    Idea or Suggestion Stock by Attributes and displaying next to attributes for Customers 1.3.8

    Okay I use stock by attributes...sorry I don't remember which version at this point. I dowloaded the latest in December 2008. It works great for me as we use Zen cart to sell tickets for gaming conventions.

    What I need though is to show the quatity of tickets left next to the time slots shown by attributes. I found Grayson's Mod here: http://www.zen-cart.com/forum/showth...=25987&page=11 Pages 11-19. However it seems to be for an old version of Zen Cart. After reading pages of theads which state PM Grayson...I thought I'd post what I did.

    So here's what I did to get it to work with Version 1.3.8:

    /includes/modules/attributes.php

    Find:

    Code:
       $sql = "select  pov.products_options_values_id,
                 pov.products_options_values_name,
                 pa.*
            from   " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
            where   pa.products_id = '" . (int)$_GET['products_id'] . "'
            and    pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
            and    pa.options_values_id = pov.products_options_values_id
            and    pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
            $order_by;
    Replace it with:

    Code:
        if ($products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_TEXT && $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_FILE && $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_READONLY) {
        $sql = "select  pov.products_options_values_id,
                 pov.products_options_values_name,
                 pwas.quantity,
                 pa.*
            from   " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
            where   pa.products_id = '" . (int)$_GET['products_id'] . "'
            and    pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
            and    pa.options_values_id = pov.products_options_values_id
            and    pwas.stock_attributes = pa.products_attributes_id
            and    pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
            $order_by;
        } else {
        $sql = "select  pov.products_options_values_id,
                 pov.products_options_values_name,
                 pa.*
            from   " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
            where   pa.products_id = '" . (int)$_GET['products_id'] . "'
            and    pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
            and    pa.options_values_id = pov.products_options_values_id
            and    pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
            $order_by;
        }
    In the same file find:

    Code:
     if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO or $products_options->RecordCount() == 1 or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
          $products_options_value_id = $products_options->fields['products_options_values_id'];
          if ($products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_TEXT and $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_FILE) {
           $products_options_details = $products_options->fields['products_options_values_name'];
          } else {
           // don't show option value name on TEXT or filename
           $products_options_details = '';
          }
          if ($products_options_names->fields['products_options_images_style'] >= 3) {
           $products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
           $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
          } else {
           $products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
           $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
          }
         }
    Replace it with:

    Code:
     if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO or $products_options->RecordCount() == 1 or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
          $products_options_value_id = $products_options->fields['products_options_values_id'];
          if ($products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_TEXT and $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_FILE) {
    //       $products_options_details = $products_options->fields['products_options_values_name'];
    // gbm - replaced original line above to display attribute stock amount beside attribute
           $products_options_details = $products_options->fields['products_options_values_name'] . ' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . ']';
          } else {
           // don't show option value name on TEXT or filename
           $products_options_details = '';
          }
          if ($products_options_names->fields['products_options_images_style'] >= 3) {
           $products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
    //       $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
    // gbm - replaced original line above to display attribute stock amount beside attribute
           $products_options_details_noname = ' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . '] ' . $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
          } else {
           $products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
    //       $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
    // gbm - replaced original line above to display attribute stock amount beside attribute
           $products_options_details_noname = ' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . '] ' . $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
          }
         }
    Then open includes/languages/english/your_template/product_info.php and add the following line:

    Code:
    define('TEXT_ATTRIBUTES_PIECES','Tickets Available');
    While this works great this now this messed up the default display only attribute I was using to make them choose a time attribute. This is a big problem as I need to force them to choose an attribute. I think it's because it's ignoring display only attributes. Can some one help me with this. I'll post again if I find an answer.

  2. #2
    Join Date
    Sep 2005
    Posts
    7
    Plugin Contributions
    0

    Default Re: Stock by Attributes and displaying next to attributes for Customers 1.3.8

    So I found out that if I add a quatitiy to the display attribute it will work but I don't want a quatity there. Is there a way to get it to display without a quantity and have the others display?


    Here's the example I am working on: http://denvergamers.org/index.php?ma...roducts_id=305

    If you don't choose a time it gives an error (which I want) but If I remove the quantity than it disappears.

  3. #3
    Join Date
    Sep 2005
    Posts
    7
    Plugin Contributions
    0

    Default Re: Stock by Attributes and displaying next to attributes for Customers 1.3.8

    Okay I've figured out that Stock by Attributes lets me put in 0 for the quantity. So Please select a time will show up showing 0 tickets available. Yeah! I'd still like no text to show next to display only attributes.

 

 

Similar Threads

  1. v151 Using Stock By Attributes, In Stock Value Is Sum Of Attributes' Stock
    By y0ul053 in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 29 Aug 2013, 04:23 PM
  2. Stock by Attributes and TEXT attributes
    By k1k2 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 Nov 2007, 09:00 AM
  3. Combining Attributes with stock and attributes w/o stock
    By ~Meg~ in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 10 Oct 2006, 09:20 AM
  4. Combining Attributes with stock and attributes w/o stock
    By ~Meg~ in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 9 Oct 2006, 06:27 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