Page 107 of 113 FirstFirst ... 75797105106107108109 ... LastLast
Results 1,061 to 1,070 of 1125
  1. #1061
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Stocks by attributes

    This is from the other thread....I think this is your issue. The new download still does not fix the stock quantity problem but we have a busy shop that is working now because I replaced the shopping_cart/header_php.php with the one in this quote.

    Quote Originally Posted by athena View Post
    I'm not a moderator here but this is what worked for me:

    Yes, You can over write the files.

    for the version you installed i don't think you need to run any additional sql statments

    here is the one from the "stock_by_attributes_4-7MULTIADD"

    just replace the code in shopping_cart/header_php.php with this:

    Code:
    <?php
    /**
     * shopping_cart header_php.php
     *
     * @package page
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: header_php.php 0000 2007-12-02 00:00:00Z kuroi $
     */
    
    // This should be first line of the script:
    $zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART');
    
    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    $breadcrumb->add(NAVBAR_TITLE);
    
    // Validate Cart for checkout
    $_SESSION['valid_to_checkout'] = true;
    $_SESSION['cart_errors'] = '';
    $_SESSION['cart']->get_products(true);
    
    if (!$_SESSION['valid_to_checkout']) {
      $messageStack->add('shopping_cart', ERROR_CART_UPDATE . $_SESSION['cart_errors'] , 'caution');
    }
    
    // build shipping with Tare included
    $shipping_weight = $_SESSION['cart']->show_weight();
    /*
      $shipping_weight = 0;
      require(DIR_WS_CLASSES . 'order.php');
      $order = new order;
      require_once('includes/classes/http_client.php'); // shipping in basket
      $total_weight = $_SESSION['cart']->show_weight();
      $total_count = $_SESSION['cart']->count_contents();
      require(DIR_WS_CLASSES . 'shipping.php');
      $shipping_modules = new shipping;
      $quotes = $shipping_modules->quote();
    */
    $totalsDisplay = '';
    switch (true) {
      case (SHOW_TOTALS_IN_CART == '1'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '2'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '3'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
    }
    
    // testing/debugging
    //  require(DIR_WS_MODULES . 'debug_blocks/shopping_cart_contents.php');
    
    $flagHasCartContents = ($_SESSION['cart']->count_contents() > 0);
    $cartShowTotal = $currencies->format($_SESSION['cart']->show_total());
    
    $flagAnyOutOfStock = false;
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (($i/2) == floor($i/2)) {
        $rowClass="rowEven";
      } else {
        $rowClass="rowOdd";
      }
      switch (true) {
        case (SHOW_SHOPPING_CART_DELETE == 1):
        $buttonDelete = true;
        $checkBoxDelete = false;
        break;
        case (SHOW_SHOPPING_CART_DELETE == 2):
        $buttonDelete = false;
        $checkBoxDelete = true;
        break;
        default:
        $buttonDelete = true;
        $checkBoxDelete = true;
        break;
        $cur_row++;
      } // end switch
      $attributeHiddenField = "";
      $attrArray = false;
      $productsName = $products[$i]['name'];
    
      if (STOCK_CHECK == 'true') {
        $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
        if ($flagStockCheck == true) {
          $flagAnyOutOfStock = true;
        }
    	  $stockAvailable = zen_get_products_stock($products[$i]['id']);
      }
    
      // Push all attributes information in an array
      if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
        if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
          $options_order_by= ' ORDER BY LPAD(popt.products_options_sort_order,11,"0")';
        } else {
          $options_order_by= ' ORDER BY popt.products_options_name';
        }
        foreach ($products[$i]['attributes'] as $option => $value) {
          $attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                         FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                         WHERE pa.products_id = :productsID
                         AND pa.options_id = :optionsID
                         AND pa.options_id = popt.products_options_id
                         AND pa.options_values_id = :optionsValuesID
                         AND pa.options_values_id = poval.products_options_values_id
                         AND popt.language_id = :languageID
                         AND poval.language_id = :languageID " . $options_order_by;
    
          $attributes = $db->bindVars($attributes, ':productsID', $products[$i]['id'], 'integer');
          $attributes = $db->bindVars($attributes, ':optionsID', $option, 'integer');
          $attributes = $db->bindVars($attributes, ':optionsValuesID', $value, 'integer');
          $attributes = $db->bindVars($attributes, ':languageID', $_SESSION['languages_id'], 'integer');
          $attributes_values = $db->Execute($attributes);
          //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
          if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {
            $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
            $attr_value = $products[$i]['attributes_values'][$option];
          } else {
            $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
            $attr_value = $attributes_values->fields['products_options_values_name'];
          }
    
          $attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name'];
          $attrArray[$option]['options_values_id'] = $value;
          $attrArray[$option]['products_options_values_name'] = zen_output_string_protected($attr_value) ;
          $attrArray[$option]['options_values_price'] = $attributes_values->fields['options_values_price'];
          $attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix'];
        }
    
    		if ( STOCK_CHECK == 'true' ) {
    
    			// Added to allow individual stock of different attributes
    			unset($attributes);
    			if(is_array($products[$i]['attributes'])){
    				$attributes = $products[$i]['attributes'];
    			} else {
    				$attributes = '';
    			}
    
    			// End change
    
    			$stock_check = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);
    	
    			if (zen_not_null($stock_check))
    			{
    				$flagAnyOutOfStock = true;
    				$flagStockCheck = $stock_check;
    			  $stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);		
    			}
    		}
      } //end foreach [attributes]
      $linkProductsImage = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);
      $linkProductsName = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);
      $productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');
      $show_products_quantity_max = zen_get_products_quantity_order_max($products[$i]['id']);
      $showFixedQuantity = (($show_products_quantity_max == 1 or zen_get_products_qty_box_status($products[$i]['id']) == 0) ? true : false);
    //  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1);
    //  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', 1);
      $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']);
      $showMinUnits = zen_get_products_quantity_min_units_display($products[$i]['id']);
      $quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');
      $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);
      $productsPrice = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
      $productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
      $productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,
                                'flagStockCheck'=>$flagStockCheck,
                                'flagShowFixedQuantity'=>$showFixedQuantity,
                                'linkProductsImage'=>$linkProductsImage,
                                'linkProductsName'=>$linkProductsName,
                                'stockAvailable'=>$stockAvailable,
                                'productsImage'=>$productsImage,
                                'productsName'=>$productsName,
                                'showFixedQuantity'=>$showFixedQuantity,
                                'showFixedQuantityAmount'=>$showFixedQuantityAmount,
                                'showMinUnits'=>$showMinUnits,
                                'quantityField'=>$quantityField,
                                'buttonUpdate'=>$buttonUpdate,
                                'productsPrice'=>$productsPrice,
                                'productsPriceEach'=>$productsPriceEach,
                                'rowClass'=>$rowClass,
                                'buttonDelete'=>$buttonDelete,
                                'checkBoxDelete'=>$checkBoxDelete,
                                'id'=>$products[$i]['id'],
                                'attributes'=>$attrArray);
    } // end FOR loop
    
    
    // This should be last line of the script:
    $zco_notifier->notify('NOTIFY_HEADER_END_SHOPPING_CART');

  2. #1062

    customer issue Re: Stocks by attributes

    Quote Originally Posted by athena View Post
    This is from the other thread....I think this is your issue. The new download still does not fix the stock quantity problem but we have a busy shop that is working now because I replaced the shopping_cart/header_php.php with the one in this quote.
    Thank you very much for your response. I tried merging that header file with mine, which indeed was missing a section but it still does not work so i reversed it.

    This is what the contribution file looks like:


    <?php
    /**
    * shopping_cart header_php.php
    *

    * @package page

    * @copyright Copyright 2003-2010 Zen Cart Development Team

    * @copyright Portions Copyright 2003 osCommerce

    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

    * @version $Id: header_php.php 17948 2010-10-13 20:33:18Z drbyte $

    */



    // This should be first line of the script:

    $zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART');



    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));

    $breadcrumb->add(NAVBAR_TITLE);



    // Validate Cart for checkout

    $_SESSION['valid_to_checkout'] = true;

    $_SESSION['cart_errors'] = '';

    $_SESSION['cart']->get_products(true);



    if (!$_SESSION['valid_to_checkout']) {

    $messageStack->add('shopping_cart', ERROR_CART_UPDATE . $_SESSION['cart_errors'] , 'caution');

    }



    // build shipping with Tare included

    $shipping_weight = $_SESSION['cart']->show_weight();

    /*

    $shipping_weight = 0;

    require(DIR_WS_CLASSES . 'order.php');

    $order = new order;

    require_once('includes/classes/http_client.php'); // shipping in basket

    $total_weight = $_SESSION['cart']->show_weight();

    $total_count = $_SESSION['cart']->count_contents();

    require(DIR_WS_CLASSES . 'shipping.php');

    $shipping_modules = new shipping;

    $quotes = $shipping_modules->quote();

    */

    $totalsDisplay = '';

    switch (true) {

    case (SHOW_TOTALS_IN_CART == '1'):

    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());

    break;

    case (SHOW_TOTALS_IN_CART == '2'):

    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());

    break;

    case (SHOW_TOTALS_IN_CART == '3'):

    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());

    break;

    }

    // testing/debugging
    // require(DIR_WS_MODULES . 'debug_blocks/shopping_cart_contents.php');

    $flagHasCartContents = ($_SESSION['cart']->count_contents() > 0);
    $cartShowTotal = $currencies->format($_SESSION['cart']->show_total());

    $flagAnyOutOfStock = false;

    $products = $_SESSION['cart']->get_products();

    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

    if (($i/2) == floor($i/2)) {

    $rowClass="rowEven";

    } else {

    $rowClass="rowOdd";

    }

    switch (true) {

    case (SHOW_SHOPPING_CART_DELETE == 1):

    $buttonDelete = true;

    $checkBoxDelete = false;

    break;

    case (SHOW_SHOPPING_CART_DELETE == 2):

    $buttonDelete = false;

    $checkBoxDelete = true;

    break;

    default:

    $buttonDelete = true;

    $checkBoxDelete = true;

    break;

    $cur_row++;

    } // end switch

    $attributeHiddenField = "";

    $attrArray = false;

    $productsName = $products[$i]['name'];

    // Push all attributes information in an array

    if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

    if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {

    $options_order_by= ' ORDER BY LPAD(popt.products_options_sort_order,11,"0")';

    } else {

    $options_order_by= ' ORDER BY popt.products_options_name';

    }

    foreach ($products[$i]['attributes'] as $option => $value) {

    $attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix

    FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

    WHERE pa.products_id = roductsID

    AND pa.options_id = :optionsID

    AND pa.options_id = popt.products_options_id

    AND pa.options_values_id = :optionsValuesID

    AND pa.options_values_id = poval.products_options_values_id

    AND popt.language_id = :languageID

    AND poval.language_id = :languageID " . $options_order_by;



    $attributes = $db->bindVars($attributes, 'roductsID', $products[$i]['id'], 'integer');

    $attributes = $db->bindVars($attributes, ':optionsID', $option, 'integer');

    $attributes = $db->bindVars($attributes, ':optionsValuesID', $value, 'integer');

    $attributes = $db->bindVars($attributes, ':languageID', $_SESSION['languages_id'], 'integer');

    $attributes_values = $db->Execute($attributes);

    //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily

    if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {

    $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);

    $attr_value = htmlspecialchars($products[$i]['attributes_values'][$option], ENT_COMPAT, CHARSET, TRUE);

    } else {

    $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

    $attr_value = $attributes_values->fields['products_options_values_name'];

    }



    $attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name'];

    $attrArray[$option]['options_values_id'] = $value;

    $attrArray[$option]['products_options_values_name'] = $attr_value;

    $attrArray[$option]['options_values_price'] = $attributes_values->fields['options_values_price'];

    $attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix'];

    }
    // stock by attributes
    if ( STOCK_CHECK == 'true' ) {

    // Added to allow individual stock of different attributes
    unset($attributes);
    if(is_array($products[$i]['attributes'])){
    $attributes = $products[$i]['attributes'];
    } else {
    $attributes = '';
    }

    $stock_check = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);

    if (zen_not_null($stock_check))
    {
    $flagAnyOutOfStock = true;
    $flagStockCheck = $stock_check;
    $stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
    }
    }
    // end stock by attributes
    } //end foreach [attributes]
    /*
    if (STOCK_CHECK == 'true') {

    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);

    if ($flagStockCheck == true) {

    $flagAnyOutOfStock = true;

    }

    }
    */
    $linkProductsImage = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);

    $linkProductsName = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);

    $productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');

    $show_products_quantity_max = zen_get_products_quantity_order_max($products[$i]['id']);

    $showFixedQuantity = (($show_products_quantity_max == 1 or zen_get_products_qty_box_status($products[$i]['id']) == 0) ? true : false);

    // $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1);

    // $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', 1);

    $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']);

    $showMinUnits = zen_get_products_quantity_min_units_display($products[$i]['id']);

    $quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');

    $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);

    $tmp = zen_add_tax($products[$i]['final_price'],zen_get_tax_rate($products[$i]['tax_class_id']));

    // $productsPriceEach = $currencies->rateAdjusted($tmp);

    // $productsPriceTotal = $productsPriceEach * $products[$i]['quantity'];

    $productsPriceTotal = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

    $productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

    // $productsPriceTotal = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

    // echo $currencies->rateAdjusted($tmp);

    $productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,

    'flagStockCheck'=>$flagStockCheck,

    'flagShowFixedQuantity'=>$showFixedQuantity,

    'linkProductsImage'=>$linkProductsImage,

    'linkProductsName'=>$linkProductsName,
    'stockAvailable'=>$stockAvailable,
    'productsImage'=>$productsImage,

    'productsName'=>$productsName,

    'showFixedQuantity'=>$showFixedQuantity,

    'showFixedQuantityAmount'=>$showFixedQuantityAmount,

    'showMinUnits'=>$showMinUnits,

    'quantityField'=>$quantityField,

    'buttonUpdate'=>$buttonUpdate,

    'productsPrice'=>$productsPriceTotal,

    'productsPriceEach'=>$productsPriceEach,

    'rowClass'=>$rowClass,

    'buttonDelete'=>$buttonDelete,

    'checkBoxDelete'=>$checkBoxDelete,

    'id'=>$products[$i]['id'],

    'attributes'=>$attrArray);

    } // end FOR loop


    // This should be last line of the script:

    $zco_notifier->notify('NOTIFY_HEADER_END_SHOPPING_CART');
    ?>



    www.ahaccessories.com

  3. #1063
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Stocks by attributes

    I also tried merging it with no success.

    My strategy, until someone pays more attention to this being an issue, is to just replace the file with the other to get my shop up and running.

    Like you, I prefer to use all the updated files, but so far replacing this one file has been working for us through some busy busy months without fail. I'm sure it will be dealt with eventually by the mod creator.

  4. #1064

    Default Re: Stocks by attributes

    Quote Originally Posted by athena View Post
    I also tried merging it with no success.

    My strategy, until someone pays more attention to this being an issue, is to just replace the file with the other to get my shop up and running.

    Like you, I prefer to use all the updated files, but so far replacing this one file has been working for us through some busy busy months without fail. I'm sure it will be dealt with eventually by the mod creator.
    The above mentioned is working for me as far as telling the customer that the item qty is higher than the stock available, it just doesn't show them how much stock there is for the attribute.

    I guess not having the skills to do it myself I will have to just hope that they address this issue.

    Thank you for your responses.
    A&H Accessories, Shop for unique hair and fashion accessories.
    Browse barrettes, clips, bows, headbands & more
    www.ahaccessories.com

  5. #1065
    Join Date
    May 2010
    Location
    Cyberspace
    Posts
    376
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Quote Originally Posted by limelites View Post
    Ahaaaaaaa, figured this one out guys!!

    For anyone else having a problem with this issue, just look at re-installing the files that shipped with the stock_by_attributes mod.

    I've just cured my problems by overwriting /includes/classes/order.php with the order.php from "stock_by_attributes_4-7MULTIADD mod"

    Somehow some other mod had corrupted the data that updates the "Quantity in Stock" in ADMIN>CATALOG>PRODUCTS WITH ATTRIBUTES".

    It is now updating the Quantity in Stock Column with each sale. All working perfectly now.

    Additionally, if you want the attribute in the drop down menu to automatically disable when the attribute quantity = zero, then you have to open /includes/modules/attributes.php and replace this:
    PHP 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
    with this:
    PHP Code:
    $sql=    "SELECT  pov.products_options_values_id,
                                pov.products_options_values_name,
                                pa.*,
                                pwas.*
                    FROM   " 
    TABLE_PRODUCTS_OPTIONS_VALUES " pov, " TABLE_PRODUCTS_ATTRIBUTES " pa LEFT JOIN " TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK " pwas ON pwas.stock_attributes = pa.products_attributes_id
                    WHERE   pa.products_id = '" 
    . (int)$_GET['products_id'] . "'
                       and    pa.options_id = '" 
    . (int)$products_options_names->fields['products_options_id'] . "'
                    and    (pwas.quantity > 0 or pwas.quantity IS NULL)
                      and    pa.options_values_id = pov.products_options_values_id
                     and       pov.language_id = '" 
    . (int)$_SESSION['languages_id'] . "' " .
                    
    $order_by
    Thanks!

  6. #1066
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Stocks by attributes

    so Sonicc...did you use the current mod or the "stock_by_attributes_4-7MULTIADD mod"?

  7. #1067
    Join Date
    May 2010
    Location
    Cyberspace
    Posts
    376
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Quote Originally Posted by athena View Post
    so Sonicc...did you use the current mod or the "stock_by_attributes_4-7MULTIADD mod"?
    Well Athena, I used the latest version (supplied by that software guy) and just made the modifications described above to my includes/modules/attributes.php file. I used the attributes file from ZenCart version 1.39h.

    Thanks

  8. #1068
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Stocks by attributes

    I hope to go back to this and spend some time trying to figure out why mine works.

    It does tell the customer how many are in stock, unlike poster "cooler0918" has going on; but I suspect the file I'm using is just by passing the Ajax function altogether. I've never dealt with Ajax, so have to learn.

    It would be nice to have the choice disappear when none are in stock. I'll try your edit to my install, but my orders.php has become way too complicated with all the mods we've installed to just replace it.

    Thanks

  9. #1069
    Join Date
    May 2010
    Location
    Cyberspace
    Posts
    376
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Hope it works!

  10. #1070
    Join Date
    Aug 2006
    Location
    portlandish, oregon
    Posts
    799
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    I just installed this mod for the first time, and the only issue I am having is that the 'SAVE' button does not seem to be working so it is not registering that attribute quantities were added.

 

 

Similar Threads

  1. v139h Stocks of certain products disappearing automatically
    By Lowwi in forum General Questions
    Replies: 4
    Last Post: 11 Aug 2015, 09:09 PM
  2. Installing Stocks by Attribute
    By dragon03kf in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 Oct 2008, 07:42 PM
  3. Stocks by attributes
    By hcd888 in forum General Questions
    Replies: 1
    Last Post: 12 May 2008, 08:52 AM
  4. Multiple stocks per product
    By jaycode in forum General Questions
    Replies: 4
    Last Post: 5 Aug 2007, 11:55 AM
  5. Products with attribute stocks
    By Svanis in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 5 Jul 2006, 03:19 AM

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