Exemplo n.º 1
0
function olc_check_stock($products_id, $products_quantity)
{
    $stock_left = olc_get_products_stock($products_id) - $products_quantity;
    if ($stock_left < 0) {
        $out_of_stock = '<span class="markProductOutOfStock">' . BLANK . ltrim(STOCK_MARK_PRODUCT_OUT_OF_STOCK) . '</span>';
    } else {
        $out_of_stock = EMPTY_STRING;
    }
    return $out_of_stock;
}
 $total_price = olc_format_price($price_single * $products_quantity, 1, 1);
 if ($show_saved_cart) {
     $products_qty = $products_quantity;
 } else {
     if (USE_AJAX) {
         $parameter = str_replace(HASH, $i, $parameter0);
         $parameter1 = str_replace(HASH, $i, $parameter10);
         $parameter2 = str_replace(HASH, $i, $parameter20);
         $parameter3 = str_replace(HASH, $i, $parameter30);
         $parameter4 = str_replace(HASH, $i, $parameter40);
         $parameter5 = str_replace(HASH, $i, $parameter50);
         $total_price = $parameter3 . $total_price . $span_end_text;
     }
     $products_qty = olc_draw_input_field($cart_quantity_text, $products_quantity, $parameter) . olc_draw_hidden_field($cart_min_quantity_text, $products_min_quantity, $parameter4) . olc_draw_hidden_field($products_id_text, $product_id, $parameter1);
     if ($do_stock_check) {
         $products_qty .= olc_draw_hidden_field($cart_stock_quantity_text, olc_get_products_stock($product_id), $parameter5);
     }
 }
 $auctionid = $product['auctionid'];
 if ($auctionid) {
     //no deletebox
     $mydelete = EMPTY_STRING;
     //quantity is hidden - no changes can be made by the user
     $myquantity = $products_quantity . str_replace(HASH, $products_quantity, $hidden_quantity) . str_replace(HASH, $product_id, $hidden_product_id);
     //link to ebay-auction
     $mylink = str_replace(HASH, $auctionid, $ebay_link);
     //as title show ebayicon - so user knows that this is the product bought at ebay
     $myimage = HTML_A_START . $mylink . '">' . $ebay_image . HTML_A_END;
 } else {
     //if product is not a auction - deletebox can be shown
     $mydelete = olc_draw_checkbox_field($cart_delete_text, $product_id, false, $parameter2);
     } else {
         $allow_purchase = true;
     }
     if ($allow_purchase) {
         //W. Kaiser - AJAX
         $parameter = 'size="3"';
         if (USE_AJAX) {
             $action = 'products_quantity_changed(this,"' . $form_action . '",#)';
             //$parameter.=' onkeyup='.str_replace(HASH,'false',$action);
             $parameter .= ' onchange=' . str_replace(HASH, 'true', $action);
         }
         $products_min_order_quantity = max(1, $product_info['products_min_order_quantity']);
         $qty_field = olc_draw_input_field('products_qty', $products_min_order_quantity, $parameter) . olc_draw_hidden_field('products_id', $products_id) . olc_draw_hidden_field('products_min_order_quantity', $products_min_order_quantity);
         $do_stock_check = STOCK_CHECK == TRUE_STRING_S;
         if ($do_stock_check) {
             $products_qty .= olc_draw_hidden_field('cart_stock_quantity', olc_get_products_stock($products_id));
         }
         if ($is_gallery) {
             $qty_field .= olc_draw_hidden_field($gallery_text, TRUE_STRING_S);
         }
         $info_smarty->assign('ADD_QTY', $qty_field);
         $info_smarty->assign('ADD_CART_BUTTON', olc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, ' id="update_cart" align="middle"', USE_AJAX));
         if ($is_gallery) {
             $info_smarty->assign('ABORT_BUTTON', HTML_A_START . olc_href_link(FILENAME_GALLERY) . '">' . olc_image(CURRENT_TEMPLATE_BUTTONS . 'button_back.gif', IMAGE_BUTTON_CANCEL, EMPTY_STRING, EMPTY_STRING)) . HTML_A_END;
         }
         //W. Kaiser - AJAX
     }
 }
 //	W. Kaiser	chCounter inclusion
 if ($not_is_gallery_and_not_isprint_version) {
     if (CHCOUNTER_ACTIVE) {