/**
  * Method to handle cart Action - buy now
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionBuyNow($goto, $parameters)
 {
     global $messageStack;
     if ($this->display_debug_messages) {
         $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__ . ' $_GET[products_id]: ' . $_GET['products_id'], 'caution');
     }
     $this->flag_duplicate_msgs_set = FALSE;
     if (isset($_GET['products_id'])) {
         if (zen_has_product_attributes($_GET['products_id'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']));
         } else {
             $add_max = zen_get_products_quantity_order_max($_GET['products_id']);
             $cart_qty = $this->in_cart_mixed($_GET['products_id']);
             $new_qty = zen_get_buy_now_qty($_GET['products_id']);
             if (!is_numeric($new_qty) || $new_qty < 0) {
                 // adjust quantity when not a value
                 $chk_link = '<a href="' . zen_href_link(zen_get_info_page($_GET['products_id']), 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_GET['products_id'])) . '&products_id=' . $_GET['products_id']) . '">' . zen_get_products_name($_GET['products_id']) . '</a>';
                 $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($new_qty), 'caution');
                 $new_qty = 0;
             }
             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 (zen_get_products_quantity_order_max($_GET['products_id']) == 1 and $this->in_cart_mixed($_GET['products_id']) == 1) {
                 // do not add
             } else {
                 // check for min/max and add that value or 1
                 // $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);
                 $this->add_cart($_GET['products_id'], $this->get_quantity($_GET['products_id']) + $new_qty);
             }
         }
     }
     // display message if all is good and not on shopping_cart page
     if (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));
         }
     }
     if (is_array($parameters) && !in_array('products_id', $parameters) && !strpos($goto, 'reviews') > 5) {
         $parameters[] = 'products_id';
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
<br class="clearBoth" />

<!--bof Add to Cart Box -->
<?php 
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
    // do nothing
} else {
    ?>
            <?php 
    $display_qty = ($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '';
    if ($products_qty_box_status == 0 or $products_quantity_order_max == 1) {
        // hide the quantity box and default to 1
        $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int) $_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
    } else {
        // show the quantity box
        $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($_GET['products_id']) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int) $_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int) $_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
    }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
    ?>
  <?php 
    if ($display_qty != '' or $display_button != '') {
        ?>
    <div id="cartAdd">
    <?php 
        echo $display_qty;
        echo $display_button;
        ?>
          </div>
  <?php 
    }
    // display qty and button
    public static function add_to_cart()
    {
        global $flag_show_product_info_in_cart_qty, $products_qty_box_status;
        global $products_quantity_order_max, $_GET, $display_qty;
        $button = '';
        $show_qty_in_cart = $flag_show_product_info_in_cart_qty == 1 && $_SESSION['cart']->in_cart($_GET['products_id']);
        if ($show_qty_in_cart) {
            $cart_quantity = $_SESSION['cart']->get_quantity($_GET['products_id']);
            $button .= '<p class="text-center" id="in-cart-text"><small>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $cart_quantity . '</small></p>';
        }
        $submit_button = '<button type="submit" class="btn btn-primary">' . BUTTON_IN_CART_ALT . '</button>';
        $hide_quantity_input = $products_qty_box_status == 0 || $products_quantity_order_max == 1;
        if ($hide_quantity_input) {
            // Default to a quantity of 1
            $button .= $submit_button . zen_draw_hidden_field('cart_quantity', 1) . zen_draw_hidden_field('products_id', (int) $_GET['products_id']);
        } else {
            $quantity = zen_get_buy_now_qty($_GET['products_id']);
            $min_quantity = zen_get_products_quantity_min_units_display((int) $_GET['products_id']);
            $hidden = zen_draw_hidden_field('products_id', (int) $_GET['products_id']);
            $button .= <<<HTML
<div class='input-group'>
  <input class='form-control' type='text' name='cart_quantity' value='{$quantity}'
         maxlength='6' size='3' />
  <span class='input-group-btn'>{$submit_button}</span>
</div> {$min_quantity} {$hidden}
HTML;
        }
        $display_button = zen_get_buy_now_button($_GET['products_id'], $button);
        $display_button = BootstrapUtils::clean_buy_now_button($display_button, '');
        if ($display_button != '' || $display_qty != '') {
            return "<div id='cart-add'>{$display_qty} {$display_button}</div>";
        }
    }
Esempio n. 4
0
         $lc_button = '<span class="more-info"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a></span>';
     } else {
         if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
             if ($listing->fields['products_qty_box_status'] != 0 && zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N' && $listing->fields['product_is_call'] == 0 && ($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0)) {
                 $how_many++;
             }
             // hide quantity box
             if ($listing->fields['products_qty_box_status'] == 0) {
                 $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
             } else {
                 $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
             }
         } else {
             // qty box with add to cart button
             if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
                 $lc_button = zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($listing->fields['products_id']) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
             } else {
                 $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
             }
         }
     }
     $the_button = $lc_button;
     $products_link = '<span class="more-info"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a></span>';
     $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
     $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '' : '');
     break;
 case 'PRODUCT_LIST_QUANTITY':
     $lc_align = 'right';
     $lc_text = $listing->fields['products_quantity'];
     break;
 case 'PRODUCT_LIST_WEIGHT':
 function get_product_cart_button($fields)
 {
     $cart_button = "";
     $products_id = (int) $fields['products_id'];
     if (zen_has_product_attributes($products_id) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
         // オプション属性があったら、購入ボタンではなく詳細画面のリンクにする
         $cart_button = '<a href="' . $fields['url'] . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
             // do nothing
         } else {
             $flag_show_product_info_in_cart_qty = zen_get_show_product_switch($products_id, 'in_cart_qty');
             $display_qty = ($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($products_id)) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($products_id) . '</p>' : '';
             if ($fields['products_qty_box_status'] == 0 or $fields['products_quantity_order_max'] == 1) {
                 // hide the quantity box and default to 1
                 $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', $products_id) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
             } else {
                 // show the quantity box
                 $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($products_id) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display($products_id) . '<br />' . zen_draw_hidden_field('products_id', $products_id) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
             }
             $display_button = zen_get_buy_now_button($products_id, $the_button);
             if ($display_qty != '' or $display_button != '') {
                 $cart_button = zen_draw_form('cart_quantity_' . $products_id, zen_href_link(zen_get_info_page($products_id), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"');
                 $cart_button .= '<div>';
                 $cart_button .= $display_qty;
                 $cart_button .= $display_button;
                 $cart_button .= '</div>';
                 $cart_button .= '</form>';
             }
         }
     }
     return $cart_button;
 }
 public static function product_cart_button($product, $product_link)
 {
     global $how_many;
     $has_attributes = zen_has_product_attributes($product->fields['products_id']);
     $hide_quantity = $product->fields['products_qty_box_status'] == 0;
     if ($has_attributes || PRODUCT_LIST_PRICE_BUY_NOW == '0') {
         $lc_button = "<a class='btn btn-default' href='{$product_link}'>" . MORE_INFO_TEXT . "</a>";
     } elseif (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
         $can_add_to_cart = zen_get_products_allow_add_to_cart($product->fields['products_id']) != 'N';
         $in_stock_or_ignore_stock = $product->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0;
         $not_call_for_price = $product->fields['product_is_call'] == 0;
         if (!$hide_quantity && $can_add_to_cart && $not_call_for_price && $in_stock_or_ignore_stock) {
             $how_many++;
         }
         if ($hide_quantity) {
             $buy_now_link = zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $product->fields['products_id']);
             $buy_now_button = "<button class='btn btn-primary'>" . BUTTON_BUY_NOW_ALT . "</button>";
             $lc_button = "<a href='{$buy_now_link}'>{$buy_now_button}</a>";
         } else {
             $add_to_cart_button = '<span class="input-group-btn">' . '<button class="btn btn-primary" type="submit">Add</button></span>';
             $lc_button = "<div class='input-group'>" . "<input type='text' class='form-control' name='products_id[" . "{$product->fields['products_id']}]' value='1' size='4' />" . "{$add_to_cart_button}</div>";
         }
     } elseif (PRODUCT_LIST_PRICE_BUY_NOW == '2' && !$hide_quantity) {
         $action_link = zen_href_link(zen_get_info_page($product->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $product->fields['products_id']);
         $buy_now_qty = zen_get_buy_now_qty($product->fields['products_id']);
         $lc_button = zen_draw_form('cart_quantity', $action_link, 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . $buy_now_qty . '" ' . 'maxlength="6" size="4" />' . zen_draw_hidden_field('products_id', $product->fields['products_id']) . "<button class='btn btn-default' type='submit'>" . BUTTON_IN_CART_ALT . "</button></form>";
     } else {
         $action_link = zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $product->fields['products_id']);
         $buy_now_button = zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"');
         $lc_button = "<a class='btn btn-default' href='{$action_link}'>" . BUTTON_BUY_NOW_ALT . "</a>";
     }
     return $lc_button;
 }
 /**
  * Method to handle cart Action - buy now
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionBuyNow($goto, $parameters)
 {
     global $messageStack;
     if (isset($_GET['products_id'])) {
         if (zen_has_product_attributes($_GET['products_id'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']));
         } else {
             $add_max = zen_get_products_quantity_order_max($_GET['products_id']);
             $cart_qty = $this->in_cart_mixed($_GET['products_id']);
             $new_qty = zen_get_buy_now_qty($_GET['products_id']);
             //die('I see Buy Now Cart: ' . $add_max . ' - cart qty: ' . $cart_qty . ' - newqty: ' . $new_qty);
             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 (zen_get_products_quantity_order_max($_GET['products_id']) == 1 and $this->in_cart_mixed($_GET['products_id']) == 1) {
                 // do not add
             } else {
                 // check for min/max and add that value or 1
                 // $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);
                 $this->add_cart($_GET['products_id'], $this->get_quantity($_GET['products_id']) + $new_qty);
             }
         }
     }
     // 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');
     }
     if (is_array($parameters) && !in_array('products_id', $parameters) && !strpos($goto, 'reviews') > 5) {
         $parameters[] = 'products_id';
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
Esempio n. 8
0
 /**
  * Method to handle cart Action - buy now
  *
  * @param string forward destination
  * @param url parameters
  */
 public function actionBuyNow($goto, $parameters)
 {
     if (isset($_GET['products_id'])) {
         if (zen_has_product_attributes($_GET['products_id'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']));
         } else {
             $add_max = zen_get_products_quantity_order_max($_GET['products_id']);
             $cart_qty = $this->in_cart_mixed($_GET['products_id']);
             $new_qty = zen_get_buy_now_qty($_GET['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 (zen_get_products_quantity_order_max($_GET['products_id']) == 1 and $this->in_cart_mixed($_GET['products_id']) == 1) {
                 // do not add
             } else {
                 // check for min/max and add that value or 1
                 $this->add_cart($_GET['products_id'], $this->get_quantity($_GET['products_id']) + $new_qty);
             }
         }
     }
     // display message if all is good and not on shopping_cart page
     if (DISPLAY_CART == 'false' && $this->getMainPage() != 'shopping_cart') {
         $this->getMessageStack()->add_session('header', SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
     }
     if (is_array($parameters) && !in_array('products_id', $parameters) && !strpos($goto, 'reviews') > 5) {
         $parameters[] = 'products_id';
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
<!--bof Add to Cart Box -->
<?php 
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
    // do nothing
} else {
    ?>
            <?php 
    $display_qty = ($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<dt>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . '</dt><dd>' . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</dd>' : '';
    if ($products_qty_box_status == 0 or $products_quantity_order_max == 1) {
        // hide the quantity box and default to 1
        $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int) $_GET['products_id']);
    } else {
        // show the quantity box
        $the_button = '';
        $the_button .= '<dt>' . PRODUCTS_ORDER_QTY . '</dt>' . "\n";
        $the_button .= '<dd><input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($_GET['products_id']) . '" maxlength="6" size="4" />' . PRODUCTS_ORDER_QTY_TEXT . '<br />' . zen_get_products_quantity_min_units_display((int) $_GET['products_id']) . '' . zen_draw_hidden_field('products_id', (int) $_GET['products_id']) . '</dd>' . "\n" . '</dl>' . "\n";
    }
    $in_cart_button_html = '<div class="cartAdd">' . '<div class="price">' . ((zen_has_product_attributes_values((int) $_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int) $_GET['products_id']) . '</div>' . "\n" . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT, 'class="imgover"') . '</div>';
    $the_button .= $in_cart_button_html;
    $display_button = ($advanced_stock_button = zen_addOnModules_call_function('advanced_stock', 'advanced_stock_get_buy_now_button', array($_GET['products_id'], $the_button))) != '' ? $advanced_stock_button : zen_get_buy_now_button($_GET['products_id'], $the_button);
    ?>

<?php 
    if ($display_qty != '' or $display_button != '') {
        echo $display_qty;
        echo $display_button;
    }
    // display qty and button
}
// CUSTOMERS_APPROVAL == 3
?>
Esempio n. 10
0
 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 - buy now
  *
  * @param string forward destination
  * @param url parameters
  */
 function actionBuyNow($goto, $parameters)
 {
     if (isset($_GET['products_id'])) {
         if (zen_has_product_attributes($_GET['products_id'])) {
             zen_redirect(zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']));
         } else {
             $add_max = zen_get_products_quantity_order_max($_GET['products_id']);
             $cart_qty = $this->in_cart_mixed($_GET['products_id']);
             $new_qty = zen_get_buy_now_qty($_GET['products_id']);
             //die('I see Buy Now Cart: ' . $add_max . ' - cart qty: ' . $cart_qty . ' - newqty: ' . $new_qty);
             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 (zen_get_products_quantity_order_max($_GET['products_id']) == 1 and $this->in_cart_mixed($_GET['products_id']) == 1) {
                 // do not add
             } else {
                 // check for min/max and add that value or 1
                 // $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);
                 $this->add_cart($_GET['products_id'], $this->get_quantity($_GET['products_id']) + $new_qty);
             }
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
 }
					<dd>
						<div class="product-attributes">
							<?php 
require display_tpl('tpl_modules_attributes');
?>
						</div>
					</dd>
					<dd class="product-quantity">
						<div class="form-inline">
							<div class="form-group">
								<label for="qty"><?php 
echo PRODUCTS_ORDER_QTY_TEXT;
?>
</label>
								<input  id="qty" class="form-control" type="text" name="cart_quantity" value="<?php 
echo zen_get_buy_now_qty($_GET['products_id']);
?>
" maxlength="12" size="5"/>
								<?php 
echo zen_get_products_quantity_min_units_display((int) $_GET['products_id']) . zen_draw_hidden_field('products_id', (int) $_GET['products_id']);
?>
								<input type="submit" name="add_to_cart" class="btn btn-danger" value="<?php 
echo BUTTON_IN_CART_ALT;
?>
"/>
							</div>
						</div>
						
						
					</dd>
				</dl>
    ?>
                    <?php 
    $display_qty = ($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '';
    if ($products_qty_box_status == 0 or $products_quantity_order_max == 1) {
        // hide the quantity box and default to 1
        $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int) $_GET['products_id']) . '<div class="cart_button">' . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</div>';
    } else {
        // show the quantity box
        $quantity = str_replace("Add to cart", "Quantity ", "Add to cart:");
        $the_button = '
							<div class="row">
								<div class="col-sm-3">
									<span class="label">' . $quantity . '</span>
								</div>
								<div class="col-sm-3">
									<input type="text" class="quantity-input txt txt-qty" name="cart_quantity" value="' . zen_get_buy_now_qty($_GET['products_id']) . '" maxlength="6" size="4" />
								</div>
								<div class="cart_button col-sm-6">
								<input id="custom-add-button" class="cssButton submit_button button  button_in_cart" onmouseover="this.id=\'custom-add-button-hover\', this.className=\'cssButtonHover  button_in_cart button_in_cartHover\'" onmouseout="this.id=\'custom-add-button\', this.className=\'cssButton submit_button button  button_in_cart\'" type="submit" value="ADD TO CART">
								</div>
							</div>' . zen_get_products_quantity_min_units_display((int) $_GET['products_id']) . zen_draw_hidden_field('products_id', (int) $_GET['products_id']);
    }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
    if (UN_MODULE_WISHLISTS_ENABLED) {
        $wishlist_link = '<a class="lnk" title="Wishlist" href="' . zen_href_link(UN_FILENAME_WISHLIST, 'products_id=' . $_GET['products_id'] . '&action=wishlist_add_product') . '"><i class="fa fa-heart"></i>Wishlist</a>';
    } else {
        $wishlist_link = '';
    }
    $freegift_link = '<a class="lnk" title="Free Gift" href="https://www.visual-you.com/catalog/coupons-amp-specials-ezp-23"><i style="font-size: 15px;" class="fa fa-gift"></i>Free Gift</a>';
    $compare_link = '<a class="lnk" title="Compare" href="javascript: compareNew(' . $_GET['products_id'] . ', \'add\')"><i class="fa fa-exchange"></i>Compare</a>';
    ?>
Esempio n. 14
0
     }
     if ($the_list == '') {
         // no errors
         zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     } else {
         // errors - display popup message
     }
     break;
     // performed by the 'buy now' button in product listings and review page
 // performed by the 'buy now' button in product listings and review page
 case 'buy_now':
     if (isset($_REQUEST['products_id'])) {
         if (zen_has_product_attributes($_REQUEST['products_id'])) {
             zen_redirect(CommerceProduct::getDisplayUrlFromId($_REQUEST['products_id']));
         } else {
             $gBitCustomer->mCart->addToCart($_REQUEST['products_id'], $gBitCustomer->mCart->get_quantity($_REQUEST['products_id']) + zen_get_buy_now_qty($_REQUEST['products_id']));
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     break;
 case 'multiple_products_add_product':
     while (list($key, $qty) = each($_REQUEST['products_id'])) {
         if (!zen_has_product_attributes($_REQUEST['products_id'])) {
             $gBitCustomer->mCart->addToCart($prodId, $gBitCustomer->mCart->get_quantity($prodId) + $qty);
         }
     }
     zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
     break;
 case 'notify':
     if ($gBitUser->isRegistered()) {
         if (isset($_REQUEST['products_id'])) {
Esempio n. 15
0
     if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
         if ($listing->fields['products_qty_box_status'] != 0 && zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N' && $listing->fields['product_is_call'] == 0 && ($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0)) {
             $how_many++;
         }
         // hide quantity box
         if ($listing->fields['products_qty_box_status'] == 0) {
             $add_to_cart_button = '<a class="addtocart" href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '"></a>';
         } else {
             $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" class=\"addtocart input-text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
             $lst_lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" class=\"addtocart input-text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         }
     } else {
         // qty box with add to cart button
         if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
             $lc_button = zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($listing->fields['products_id']) . '" maxlength="6" size="4" class="addtocart input-text" />&nbsp;&nbsp;' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . '<button class="button btn_addtocart">' . BUTTON_ADD_TO_CART . '</button>' . '</form>';
             $lst_lc_button = zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . zen_get_buy_now_qty($listing->fields['products_id']) . '" maxlength="6" size="4" class="addtocart input-text" />&nbsp;&nbsp;' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . '<button class="button btn_addtocart">' . BUTTON_ADD_TO_CART . '</button>' . '</form>';
         } else {
             $lc_button = '<a title="Add to Cart" class="add-to-cart product_cart_image" href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '"><span class="icon-shopcart"></span></a>';
             $lst_lc_button = '<a class="btn btn-primary btn-iconed" title="Add to Cart" href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '"><i class="icon-shopcart"></i><span>Add to Cart</span></a>';
         }
     }
 }
 $the_button = $lc_button;
 $lst_the_button = $lst_lc_button;
 $products_link = '<a class="link-learn" href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
 $product_link_only = zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']);
 $min_quantity = '<div class="product-minquantity">' . zen_get_products_quantity_min_units_display($listing->fields['products_id']) . '</div>';
 $freeshipping = '<div class="product-freeship">' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON : '' : '');
 $lst_lc_text .= '';
 $min_quantity = '<div class="product-minquantity">' . zen_get_products_quantity_min_units_display($listing->fields['products_id']) . '</div>';
 $freeshipping = '<div class="product-freeship">' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON : '' : '');