示例#1
0
function zen_get_products_quantity_min_units_display($product_id, $include_break = true, $shopping_cart_msg = false)
{
    $check_min = zen_get_products_quantity_order_min($product_id);
    $check_units = zen_get_products_quantity_order_units($product_id);
    $the_min_units = '';
    if ($check_min != 1 or $check_units != 1) {
        if ($check_min != 1) {
            $the_min_units .= PRODUCTS_QUANTITY_MIN_TEXT_LISTING . ' ' . $check_min;
        }
        if ($check_units != 1) {
            $the_min_units .= ($the_min_units ? ' ' : '') . PRODUCTS_QUANTITY_UNIT_TEXT_LISTING . ' ' . $check_units;
        }
        if (($check_min > 0 or $check_units > 0) and !zen_get_products_quantity_mixed($product_id)) {
            if ($include_break == true) {
                $the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
            } else {
                $the_min_units .= '&nbsp;&nbsp;' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_OFF : TEXT_PRODUCTS_MIX_OFF_SHOPPING_CART);
            }
        } else {
            if ($include_break == true) {
                $the_min_units .= '<br />' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
            } else {
                $the_min_units .= '&nbsp;&nbsp;' . ($shopping_cart_msg == false ? TEXT_PRODUCTS_MIX_ON : TEXT_PRODUCTS_MIX_ON_SHOPPING_CART);
            }
        }
    }
    // quantity max
    $check_max = zen_get_products_quantity_order_max($product_id);
    if ($check_max != 0) {
        if ($include_break == true) {
            $the_min_units .= ($the_min_units != '' ? '<br />' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . '&nbsp;' . $check_max;
        } else {
            $the_min_units .= ($the_min_units != '' ? '&nbsp;&nbsp;' : '') . PRODUCTS_QUANTITY_MAX_TEXT_LISTING . '&nbsp;' . $check_max;
        }
    }
    return $the_min_units;
}
示例#2
0
            $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'];
        }
    }
    //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"  onfocus="set_update_count(this);" onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\\d]/g,\'\'));update_count(this);" onkeyup="value=value.replace(/[^\\d]/g,\'\');update_count(this);" class="check_input_num" id="cart_quantity[]"');
    $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, '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
$flag_disable_footer = TRUE;
$flag_disable_header = TRUE;
// This should be last line of the script:
 /**
  * Method to handle cart Action - multiple add products
  *
  * @param string forward destination
  * @param url parameters
  * @todo change while loop to a foreach
  */
 function actionMultipleAddProduct($goto, $parameters)
 {
     global $messageStack;
     if ($this->display_debug_messages) {
         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__, 'caution');
     }
     $addCount = 0;
     if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
         //echo '<pre>'; echo var_dump($_POST['products_id']); echo '</pre>';
         while (list($key, $val) = each($_POST['products_id'])) {
             $prodId = preg_replace('/[^0-9a-f:.]/', '', $key);
             if (is_numeric($val) && $val > 0) {
                 $adjust_max = false;
                 $qty = $val;
                 $add_max = zen_get_products_quantity_order_max($prodId);
                 $cart_qty = $this->in_cart_mixed($prodId);
                 $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
                 // bof: adjust new quantity to be same as current in stock
                 $chk_current_qty = zen_get_products_stock($prodId);
                 if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty > $chk_current_qty) {
                     $new_qty = $chk_current_qty;
                     $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                 }
                 // eof: adjust new quantity to be same as current in stock
                 if ($add_max == 1 and $cart_qty == 1) {
                     // do not add
                     $adjust_max = 'true';
                 } else {
                     // bof: adjust new quantity to be same as current in stock
                     if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty + $cart_qty > $chk_current_qty) {
                         $adjust_new_qty = 'true';
                         $alter_qty = $chk_current_qty - $cart_qty;
                         $new_qty = $alter_qty > 0 ? $alter_qty : 0;
                         $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                     }
                     // eof: adjust new quantity to be same as current in stock
                     // adjust quantity if needed
                     if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                         $adjust_max = 'true';
                         $new_qty = $add_max - $cart_qty;
                     }
                     $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty);
                     $addCount++;
                 }
                 if ($adjust_max == 'true') {
                     if ($this->display_debug_messages) {
                         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__ . '<br>' . ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                     }
                     $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                 }
             }
             if (!is_numeric($val) || $val < 0) {
                 // adjust quantity when not a value
                 $chk_link = '<a href="' . zen_href_link(zen_get_info_page($prodId), 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($prodId)) . '&products_id=' . $prodId) . '">' . zen_get_products_name($prodId) . '</a>';
                 $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($val), 'caution');
                 $val = 0;
             }
         }
         // display message if all is good and not on shopping_cart page
         if ($addCount && DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
             $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
         } else {
             if (DISPLAY_CART == 'false') {
                 zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
             }
         }
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     }
 }
示例#4
0
 /**
  * Method to handle cart Action - multiple add products
  *
  * @param string forward destination
  * @param url parameters
  * @todo change while loop to a foreach
  */
 public function actionMultipleAddProduct($goto, $parameters)
 {
     $addCount = 0;
     if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
         while (list($key, $val) = each($_POST['products_id'])) {
             if ($val > 0) {
                 $adjust_max = false;
                 $prodId = preg_replace('/[^0-9a-f:.]/', '', $key);
                 $qty = $val;
                 $add_max = zen_get_products_quantity_order_max($prodId);
                 $cart_qty = $this->in_cart_mixed($prodId);
                 $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
                 // ***************************************** *****************************************
                 /**
                  * Add Attributes listing to product listing page as per this thread:
                  * http://www.zen-cart.com/showthread.php?98641-drop-down-attributes-at-product-listing-page-near-add-to-cart-button&p=608469#post608469
                  */
                 if ($qty > 0) {
                     $match_product_quantity = $_POST['products_id'][$prodId];
                     if ($match_product_quantity > 0) {
                         $attributes = $_POST['id'][$prodId] ? $_POST['id'][$prodId] : '';
                     }
                     $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty, $attributes);
                 }
                 // ***************************************** *****************************************
                 if ($add_max == 1 and $cart_qty == 1) {
                     // do not add
                     $adjust_max = 'true';
                 } else {
                     // adjust quantity if needed
                     if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                         $adjust_max = 'true';
                         $new_qty = $add_max - $cart_qty;
                     }
                     $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty);
                     $addCount++;
                 }
                 if ($adjust_max == 'true') {
                     $this->getMessageStack()->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                 }
             }
         }
         // display message if all is good and not on shopping_cart page
         if ($addCount && DISPLAY_CART == 'false' && $this->getMainPage() != 'shopping_cart') {
             $this->getMessageStack()->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
         }
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     }
 }
 function verifyQuantity($pProductsKey, $pQty)
 {
     $pQty = (int) $pQty;
     // verify qty to add
     $add_max = zen_get_products_quantity_order_max($_REQUEST['products_id']);
     $cart_qty = $gBitCustomer->mCart->in_cart_mixed($_REQUEST['products_id']);
     $new_qty = zen_get_buy_now_qty($_REQUEST['products_id']);
     if ($add_max == 1 and $cart_qty == 1) {
         // do not add
         $new_qty = 0;
     } else {
         // adjust quantity if needed
         if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
             $new_qty = $add_max - $cart_qty;
         }
     }
     if (!empty($adjust_max) && $adjust_max == 'true') {
         $messageStack->add_session('header', ERROR_MAXIMUM_QTY . ' - ' . zen_get_products_name($prodId), 'caution');
     }
     if ($product = $this->getProductObject($pProductsKey)) {
         if (is_object($product) && $pQty > $product->getField('products_quantity_order_max')) {
             // we are trying to add quantity greater than max purchable quantity
             $pQty = $product->getField('products_quantity_order_max');
         }
     } else {
         // product couldn't load, delete from card
         $pQty = 0;
     }
     return $pQty;
 }
 /**
  * Method to handle cart Action - multiple add products
  *
  * @param string forward destination
  * @param url parameters
  * @todo change while loop to a foreach
  */
 function actionMultipleAddProduct($goto, $parameters)
 {
     global $messageStack;
     $addCount = 0;
     if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
         while (list($key, $val) = each($_POST['products_id'])) {
             if ($val > 0) {
                 $adjust_max = false;
                 $prodId = preg_replace('/[^0-9a-f:.]/', '', $key);
                 $qty = $val;
                 $add_max = zen_get_products_quantity_order_max($prodId);
                 $cart_qty = $this->in_cart_mixed($prodId);
                 //        $new_qty = $qty;
                 //echo 'I SEE actionMultipleAddProduct: ' . $prodId . '<br>';
                 $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
                 if ($add_max == 1 and $cart_qty == 1) {
                     // do not add
                     $adjust_max = 'true';
                 } else {
                     // adjust quantity if needed
                     if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                         $adjust_max = 'true';
                         $new_qty = $add_max - $cart_qty;
                     }
                     $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty);
                     $addCount++;
                 }
                 if ($adjust_max == 'true') {
                     //            $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' C: - ' . zen_get_products_name($prodId), 'caution');
                     $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                 }
             }
         }
         // display message if all is good and not on shopping_cart page
         if ($addCount && DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) {
             $messageStack->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
         }
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     }
 }
 /**
  * Method to handle cart Action - multiple add products
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionMultipleAddProduct($goto, $parameters)
 {
     global $messageStack;
     while (list($key, $val) = each($_POST['products_id'])) {
         if ($val > 0) {
             $prodId = $key;
             $qty = $val;
             $add_max = zen_get_products_quantity_order_max($prodId);
             $cart_qty = $this->in_cart_mixed($prodId);
             $new_qty = $qty;
             if ($add_max == 1 and $cart_qty == 1) {
                 // do not add
                 $adjust_max = 'true';
             } else {
                 // adjust quantity if needed
                 if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                     $adjust_max = 'true';
                     $new_qty = $add_max - $cart_qty;
                 }
                 $this->add_cart($prodId, $this->get_quantity($prodId) + $new_qty);
             }
             if ($adjust_max == 'true') {
                 $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' - ' . zen_get_products_name($prodId), 'caution');
             }
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
     if (STOCK_ALLOW_CHECKOUT == 'false' && $new_qty + $cart_qty > $chk_current_qty) {
         $adjust_new_qty = 'true';
         $alter_qty = $chk_current_qty - $cart_qty;
         $new_qty = $alter_qty > 0 ? $alter_qty : 0;
         if (!$_SESSION['cart']->flag_duplicate_msgs_set) {
             $messageStack->add_session('shopping_cart', ($_SESSION['cart']->display_debug_messages ? 'D: FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($_POST['products_id']), 'caution');
         }
     }
     // eof: adjust new quantity to be same as current in stock
     // adjust quantity if needed
     if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
         $adjust_max = 'true';
         $new_qty = $add_max - $cart_qty;
     }
 }
 if (zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $_SESSION['cart']->in_cart_mixed($_POST['products_id']) == 1) {
     // do not add
 } else {
     // process normally
     // bof: set error message
     if ($the_list != '') {
         $messageStack->add('product_info', ERROR_CORRECTIONS_HEADING . $the_list, 'caution');
     } else {
         // process normally
         // iii 030813 added: File uploading: save uploaded files with unique file names
         $real_ids = isset($_POST['id']) ? $_POST['id'] : "";
         if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
             /**
              * Need the upload class for attribute type that allows user uploads.
              *
              */
示例#9
0
 function actionAddProductAjaxAttributes($goto, $parameters)
 {
     global $messageStack, $db;
     if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
         // verify attributes and quantity first
         $the_list = '';
         $adjust_max = 'false';
         if (isset($_POST['id'])) {
             foreach ($_POST['id'] as $key => $value) {
                 $check = zen_get_attributes_valid($_POST['products_id'], $key, $value);
                 if ($check == false) {
                     $the_list .= TEXT_ERROR_OPTION_FOR . '<span class="alertBlack">' . zen_options_name($key) . '</span>' . TEXT_INVALID_SELECTION . '<span class="alertBlack">' . (zen_values_name($value) == 'TEXT' ? TEXT_INVALID_USER_INPUT : zen_values_name($value)) . '</span>' . '<br />';
                 }
             }
         }
         // verify qty to add
         //          $real_ids = $_POST['id'];
         //die('I see Add to Cart: ' . $_POST['products_id'] . 'real id ' . zen_get_uprid($_POST['products_id'], $real_ids) . ' add qty: ' . $add_max . ' - cart qty: ' . $cart_qty . ' - newqty: ' . $new_qty);
         $add_max = zen_get_products_quantity_order_max($_POST['products_id']);
         $cart_qty = $this->in_cart_mixed($_POST['products_id']);
         $new_qty = $_POST['cart_quantity'];
         //echo 'I SEE actionAddProduct: ' . $_POST['products_id'] . '<br>';
         $new_qty = $this->adjust_quantity($new_qty, $_POST['products_id'], 'shopping_cart');
         if ($add_max == 1 and $cart_qty == 1) {
             // do not add
             $new_qty = 0;
             $adjust_max = 'true';
         } else {
             // adjust quantity if needed
             if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                 $adjust_max = 'true';
                 $new_qty = $add_max - $cart_qty;
             }
         }
         if (zen_get_products_quantity_order_max($_POST['products_id']) == 1 and $this->in_cart_mixed($_POST['products_id']) == 1) {
             // do not add
         } else {
             // process normally
             // bof: set error message
             if ($the_list != '') {
                 //          $messageStack->add('product_info', ERROR_CORRECTIONS_HEADING . $the_list, 'caution');
                 $error_message = ERROR_CORRECTIONS_HEADING;
                 //          $messageStack->add('header', 'REMOVE ME IN SHOPPING CART CLASS BEFORE RELEASE<br/><BR />' . ERROR_CORRECTIONS_HEADING . $the_list, 'error');
             } else {
                 // process normally
                 // iii 030813 added: File uploading: save uploaded files with unique file names
                 $real_ids = isset($_POST['id']) ? $_POST['id'] : "";
                 if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
                     /**
                      * Need the upload class for attribute type that allows user uploads.
                      *
                      */
                     include DIR_WS_CLASSES . 'upload.php';
                     for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
                         if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and $_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none') {
                             $products_options_file = new upload('id');
                             $products_options_file->set_destination(DIR_FS_UPLOADS);
                             $products_options_file->set_output_messages('session');
                             if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                                 $products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
                                 if ($_SESSION['customer_id']) {
                                     $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
                                 } else {
                                     $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
                                 }
                                 $insert_id = $db->Insert_ID();
                                 $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
                                 $products_options_file->set_filename("{$insert_id}" . $products_image_extension);
                                 if (!$products_options_file->save()) {
                                     break;
                                 }
                             } else {
                                 break;
                             }
                         } else {
                             // No file uploaded -- use previous value
                             $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
                         }
                     }
                 }
                 $this->add_cart($_POST['products_id'], $this->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids)) + $new_qty, $real_ids);
                 // iii 030813 end of changes.
             }
             // eof: set error message
         }
         // eof: quantity maximum = 1
         if ($adjust_max == 'true') {
             //        $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' B: - ' . zen_get_products_name($_POST['products_id']), 'caution');
             //        $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($_POST['products_id']), 'caution');
             $error_message = ERROR_MAXIMUM_QTY;
         }
     }
     if ($the_list == '') {
         // no errors
         // display message if all is good and not on shopping_cart page
         if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) {
             $messageStack->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
             //$error_message = SUCCESS_ADDED_TO_CART_PRODUCT;
         }
         //      zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     } else {
         // errors - display popup message
     }
 }
         default:
     }
     zen_redirect(zen_href_link(FILENAME_EDIT_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
     break;
 case 'add_prdct':
     if (!zen_not_null($step)) {
         $step = 1;
     }
     if (EO_DEBUG_ACTION_LEVEL > 0) {
         eo_log(PHP_EOL . '============================================================' . PHP_EOL . '= Adding a new product to the order (step ' . $step . ')' . PHP_EOL . '============================================================' . PHP_EOL . PHP_EOL);
     }
     if ($step == 5) {
         // Get Order Info
         $GLOBALS['order'] = eo_get_order_by_id($oID);
         // Check qty field
         $add_max = zen_get_products_quantity_order_max($add_product_products_id);
         if ($add_product_quantity > $add_max && $add_max != 0) {
             $add_product_quantity = $add_max;
             $messageStack->add_session(WARNING_ORDER_QTY_OVER_MAX, 'warning');
         }
         // Retrieve the information for the new product
         $new_product = eo_get_new_product($add_product_products_id, $add_product_quantity, zen_db_prepare_input($_POST['id']), isset($_POST['applyspecialstoprice']));
         // Add the product to the order
         if (EO_DEBUG_ACTION_LEVEL > 3) {
             eo_log('Product Being Added:' . PHP_EOL . var_export($new_product, true) . PHP_EOL);
         }
         eo_add_product_to_order($oID, $new_product);
         // Update Subtotal and Pricing
         eo_update_order_subtotal($oID, $new_product);
         // Save the changes
         eo_update_database_order_totals($oID);
示例#11
0
                 // $add_qty = zen_get_buy_now_qty($_GET['products_id']);
                 //                                    $_SESSION['cart']->add_cart($_GET['products_id'], $_SESSION['cart']->get_quantity($_GET['products_id'])+$add_qty);
                 $_SESSION['cart']->add_cart($_GET['products_id'], $_SESSION['cart']->get_quantity($_GET['products_id']) + $new_qty);
             }
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     break;
     // multiple products
 // multiple products
 case 'multiple_products_add_product':
     while (list($key, $val) = each($_POST['products_id'])) {
         if ($val > 0) {
             $prodId = $key;
             $qty = $val;
             $add_max = zen_get_products_quantity_order_max($prodId);
             $cart_qty = $_SESSION['cart']->in_cart_mixed($prodId);
             $new_qty = $qty;
             if ($add_max == 1 and $cart_qty == 1) {
                 // do not add
                 $adjust_max = 'true';
             } else {
                 // adjust quantity if needed
                 if ($new_qty + $cart_qty > $add_max and $add_max != 0) {
                     $adjust_max = 'true';
                     $new_qty = $add_max - $cart_qty;
                 }
                 $_SESSION['cart']->add_cart($prodId, $_SESSION['cart']->get_quantity($prodId) + $new_qty);
             }
             if ($adjust_max == 'true') {
                 $messageStack->add_session('header', ERROR_MAXIMUM_QTY . ' - ' . zen_get_products_name($prodId), 'caution');