Zen Cart Logo
Forums / All Other Contributions/Addons / Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Views: 658,718

Results 1,041 to 1,060 of 3,609
27 Jan 2011, 3:17 PM
#1041
harmeetsandhu avatar

harmeetsandhu

New Zenner

Join Date:
Dec 2008
Posts:
14
Plugin Contributions:
0

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Chris,

That looks perfect but i dont understand why its not working for you. After i made this change this is what happens in my cart:

Item A (with attributes)
Item B (without attributes)

before if Item A is out of stock Item B will be shown out of stock but after i made the chage to the code the cart is fixed and they all come independant with their own stock.

Is this exactly what you trying to achieve.

Harmeet

27 Jan 2011, 3:22 PM
#1042
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

harmeetsandhu:

Chris,

That looks perfect but i dont understand why its not working for you. After i made this change this is what happens in my cart:

Item A (with attributes)
Item B (without attributes)

before if Item A is out of stock Item B will be shown out of stock but after i made the chage to the code the cart is fixed and they all come independant with their own stock.

Is this exactly what you trying to achieve.

Harmeet

Right, so both your items A & B get marked with *** independently? Can you post your entire header file and I'll compare and see what's different with a file compare utility? I have made a tweak in other parts of this code so maybe it's something "simple" that's going on here.

27 Jan 2011, 3:23 PM
#1043
harmeetsandhu avatar

harmeetsandhu

New Zenner

Join Date:
Dec 2008
Posts:
14
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Chris,

i compared ur code to min and i can see u have the below part repeated twice

$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'];
    }
      $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 

Do u know why ???

harmeet

27 Jan 2011, 3:23 PM
#1044
harmeetsandhu avatar

harmeetsandhu

New Zenner

Join Date:
Dec 2008
Posts:
14
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Ok this is mine:

<?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 = :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 = 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'];
    }
  } //end foreach [attributes]

  if (STOCK_CHECK == 'true') {
    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
    if ($flagStockCheck == true) {
      $flagAnyOutOfStock = true;
      $stockAvailable = zen_get_products_stock($products[$i]['id'], $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']);
  $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,
                            'stockAvailable'=>$stockAvailable,
			    'flagStockCheck'=>$flagStockCheck,
                            'flagShowFixedQuantity'=>$showFixedQuantity,
                            'linkProductsImage'=>$linkProductsImage,
                            'linkProductsName'=>$linkProductsName,
                            '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');
?>
27 Jan 2011, 3:30 PM
#1045
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

harmeetsandhu:

balticccreations,

if you can also paste the code here and i can have a look.

Will try to sort it out.

Regards

harmeet

ok thanks here's my full code!

<?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 $
 * Creinold SBA Version 5 update for Zen-Cart 1.3.9H
 */

// 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 = :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 = 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'];
    }
  } //end foreach [attributes]
 if (STOCK_CHECK == 'true') {
    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'], $attributes);
    if ($flagStockCheck == true) {
      $flagAnyOutOfStock = true;
            $stockAvailable = zen_get_products_stock($products[$i]['id'], $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']);
  $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');
?>
27 Jan 2011, 3:45 PM
#1046
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

harmeet, I don't think my particular issue is in this certain file. I say that because I copied your exact code and replaced it with mine and still had the same problem....

27 Jan 2011, 3:54 PM
#1047
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

harmeetsandhu,

Getting somewhere here. I copied and pasted your entire code and my non attribute products are working, in fact it's actually says how many are left in stock (before it only did that with attributes). But, of course it doesn't mark attribute products out of stock now (which it did before)....

So fix one break another...

27 Jan 2011, 3:59 PM
#1048
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ChrisD24:

harmeetsandhu,

Getting somewhere here. I copied and pasted your entire code and my non attribute products are working, in fact it's actually says how many are left in stock (before it only did that with attributes). But, of course it doesn't mark attribute products out of stock now (which it did before)....

So fix one break another...

Where is it not showing how many are in stock? your actual listings or in the shopping cart? Mine shows how many of everything is available on the listings (the full amount just not how many on the attribute items are available for each attribute).

If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"

27 Jan 2011, 4:05 PM
#1049
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

balticccreations:

Where is it not showing how many are in stock? your actual listings or in the shopping cart? Mine shows how many of everything is available on the listings (the full amount just not how many on the attribute items are available for each attribute).

If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"

In the shopping cart. If you have 3 left and you enter 5 I have it turned on to say how many are left (in the cart). With his code, when a product with an attribute is in the cart it doesn't show give an error about being out of stock (with the ***) and doesn't say how many are left (before it did both with my code). Now with his code, it works properly on products without attributes but does nothing on products with attributes. So something is not right here...:frusty:

27 Jan 2011, 4:11 PM
#1050
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ChrisD24:

In the shopping cart. If you have 3 left and you enter 5 I have it turned on to say how many are left (in the cart). With his code, when a product with an attribute is in the cart it doesn't show give an error about being out of stock (with the ***) and doesn't say how many are left (before it did both with my code). Now with his code, it works properly on products without attributes but does nothing on products with attributes. So something is not right here...:frusty:

I'm thinking our problems are in another file not the header one...

27 Jan 2011, 4:14 PM
#1051
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

this is my stock settings

Stock

Check stock level true
Subtract stock true
Allow Checkout false
Mark product out of stock SOLD OUT
Stock Re-order level 1
Show available stock level in cart when less than order true
Display Images in Admin false
Products status in Catalog when out of stock should be set to 0
Show Sold Out Image in place of Add to Cart 1
Product Quantity Decimals 2
Show Shopping Cart - Delete Checkboxes or Delete Button 3
Show Shopping Cart - Update Cart Button Location 3
Show New Products on empty Shopping Cart Page 1
Show Featured Products on empty Shopping Cart Page 2
Show Special Products on empty Shopping Cart Page 3
Show Upcoming Products on empty Shopping Cart Page 4
Show Notice of Combining Shopping Cart on Login 1

27 Jan 2011, 4:19 PM
#1052
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

balticccreations:

I'm thinking our problems are in another file not the header one...

You said:

"If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"

Doesn't have attributes, what happens when you have a product that does? Does it mark it in the cart too?

27 Jan 2011, 4:25 PM
#1053
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ChrisD24:

You said:

"If the product doesn't have attributes then in the cart it shows an error that says "Products marked with SOLD OUT are out of stock or there are not enough in stock to fill your order.
Please change the quantity of products marked with (SOLD OUT). Thank you" And in the shopping cart shows "SOLD OUT Stock Available: 1"

Doesn't have attributes, what happens when you have a product that does? Does it mark it in the cart too?

nope then it doesn't list how many are available nor does it let them check out if they want more than are available. Which is a good thing but they can find it to be a problem because it doesn't tell them why they can't check out. For all they know there is enough stock when in fact there isn't.

I tried adding both a product with attributes and a product without to my cart then I made the quantities higher than in stock on both and the one without showed the error I mentioned but the one with showed nothing making it look like they were available but again won't let them check out.

27 Jan 2011, 4:31 PM
#1054
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

balticccreations:

nope then it doesn't list how many are available nor does it let them check out if they want more than are available. Which is a good thing but they can find it to be a problem because it doesn't tell them why they can't check out. For all they know there is enough stock when in fact there isn't.

I tried adding both a product with attributes and a product without to my cart then I made the quantities higher than in stock on both and the one without showed the error I mentioned but the one with showed nothing making it look like they were available but again won't let them check out.

So we are both on the same page then. I need to get this fixed so it marks both types of products. It has to be this file because with one code it works flawlessly with attribute products, with another it works flawlessly without attributes. Then again why is it working for the other guy...

27 Jan 2011, 4:34 PM
#1055
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ChrisD24:

So we are both on the same page then. I need to get this fixed so it marks both types of products. It has to be this file because with one code it works flawlessly with attribute products, with another it works flawlessly without attributes. Then again why is it working for the other guy...

True. I wonder if he's using a different mod though. I'm using the one by Creinold are you? Also is he on zen-cart 1.3.9h? That's what I'm on. Could make the difference...

27 Jan 2011, 4:39 PM
#1056
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

balticccreations:

True. I wonder if he's using a different mod though. I'm using the one by Creinold are you? Also is he on zen-cart 1.3.9h? That's what I'm on. Could make the difference...

I'll have to check on my other computer when I can access it - but I think I am using by dafonz. ZC: 1.3.9g.

This is where I got mine: http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_47&products_id=310

27 Jan 2011, 4:41 PM
#1057
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ChrisD24:

I'll have to check on my other computer when I can access it - but I think I am using by dafonz. ZC: 1.3.9g.

That could be our difference then for sure...this is mine http://www.zen-cart.com/forum/showthread.php?t=166928

27 Jan 2011, 4:46 PM
#1058
chrisd24 avatar

chrisd24

New Zenner

Join Date:
Jan 2011
Posts:
37
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

balticccreations:

That could be our difference then for sure...this is mine http://www.zen-cart.com/forum/showthread.php?t=166928

Lord help me. I'll have to file compare and see where any differences lie - maybe a solution can be found. But then again, we are using two different versions and having the same outcome. :frusty::frusty::frusty:

27 Jan 2011, 4:48 PM
#1059
balticccreations avatar

balticccreations

New Zenner

Join Date:
Jan 2011
Location:
Laguna Vista TX
Posts:
42
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

lol yeah i know its got to be something simple. my issue is it not showing the number available anywhere for each attribute. only the total units available.