Ejemplo n.º 1
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':
     $lc_align = 'right';
     $lc_text = $listing->fields['products_weight'];
     break;
 case 'PRODUCT_LIST_IMAGE':
     $lc_align = 'center';
     if ($listing->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
         $lc_text = '';
     } else {
     } else {
         if (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_all->fields['products_qty_box_status'] != 0) {
             //            $how_many++;
             $link = '<span>' . TEXT_PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART . "</span><input class='input-text' type=\"text\" name=\"products_id[" . $products_all->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } else {
             $link = '<a href="' . zen_href_link(FILENAME_ALL_PRODUCTS, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_all->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
         }
     }
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($products_all->fields['products_id'], $the_button, $products_link) . zen_get_products_quantity_min_units_display($products_all->fields['products_id']) . str_repeat('', substr(PRODUCT_ALL_BUY_NOW, 3, 1));
 } else {
     $link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($products_all->fields['products_id'], $the_button, $products_link) . zen_get_products_quantity_min_units_display($products_all->fields['products_id']) . str_repeat('', substr(PRODUCT_ALL_BUY_NOW, 3, 1));
 }
 if (PRODUCT_ALL_LIST_DESCRIPTION > '0') {
     $disp_text = zen_get_products_description($products_all->fields['products_id']);
     $disp_text = zen_clean_html($disp_text);
     $display_products_description = stripslashes(zen_trunc_string($disp_text, PRODUCT_ALL_LIST_DESCRIPTION));
 } else {
     $display_products_description = '';
 }
 $get_discount_prod = mb_discount_product($products_all->fields['products_id']);
 if (mb_featured_product($products_all->fields['products_id']) == 1) {
     $ribbon = "<div class='tag tag-orange' title=''><div class='text'>HOT</div></div>";
 } else {
     if (mb_special_product($products_all->fields['products_id']) == 1) {
         $ribbon = "<div class='tag tag-orange' title=''><div class='text'>SALE</div></div>";
     } else {
Ejemplo n.º 3
0
        if ($_GET['products_filter'] != '') {
            ?>
          <tr>
            <td class="main" width="200" align="left" valign="top">&nbsp;</td>
            <td colspan="2" class="main"><?php 
            echo TEXT_PRODUCT_TO_VIEW;
            ?>
</td>
          </tr>
          <tr>
            <td class="main" width="200" align="center" valign="top">
<?php 
            $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
            echo $display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '';
            echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
            echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
            ?>
            </td>
            <td class="attributes-even" align="center"><?php 
            echo zen_draw_products_pull_down('products_filter', 'size="10"', '', true, $_GET['products_filter'], true, true);
            ?>
</td>
            <td class="main" align="right" valign="top"><?php 
            echo zen_image_submit('button_display.gif', IMAGE_DISPLAY);
            ?>
</td>
          </tr>
        </table></td>
      </form></tr>

<?php 
Ejemplo n.º 4
0
</h1></td>
    <td align="center" valign="top" class="smallText">
      <?php 
if (zen_not_null($products_image)) {
    require DIR_FS_PAGES . $current_page_base . '/main_template_vars_images.php';
}
// more info in place of buy now
if (zen_has_product_attributes($review->fields['products_id'])) {
    //   $link = '<p>' . '<a href="' . zen_href_link(zen_get_info_page($review->fields['products_id']), 'products_id=' . $review->fields['products_id'] ) . '">' . MORE_INFO_TEXT . '</a>' . '</p>';
    $link = '';
} else {
    $link = '<br /><br />' . '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now') . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
}
$the_button = $link;
$products_link = '<br />';
echo zen_get_buy_now_button($review->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($review->fields['products_id']);
?>
    </td>
  </tr>
<?php 
$review_status = " and r.`status` = '1'";
$reviews_query_raw = "select r.`reviews_id`, rd.reviews_text,\n                               r.reviews_rating, r.`date_added`, r.customers_name\n                        from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd\n                        where r.`products_id` = '" . (int) $_GET['products_id'] . "'\n                        and r.`reviews_id` = rd.`reviews_id`\n                        and rd.`languages_id` = '" . (int) $_SESSION['languages_id'] . "'" . $review_status . "\n                        order by r.`reviews_id` desc";
$reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);
if ($reviews_split->number_of_rows > 0) {
    if (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3') {
        ?>
  <tr>
    <td class="pagination"><?php 
        echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS);
        ?>
</td>
    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>";
        }
    }
         //          $link= '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
         if (PRODUCT_NEW_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_new->fields['products_qty_box_status'] != 0) {
             //            $how_many++;
             $link = TEXT_PRODUCT_NEW_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $products_new->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } else {
             $link = '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
         }
     }
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
 } else {
     $link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $the_button = $link;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $display_products_button = zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
 }
 if (PRODUCT_NEW_LIST_DESCRIPTION > '0') {
     $disp_text = zen_get_products_description($products_new->fields['products_id']);
     $disp_text = zen_clean_html($disp_text);
     $display_products_description = stripslashes(zen_trunc_string($disp_text, PRODUCT_NEW_LIST_DESCRIPTION, '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
 } else {
     $display_products_description = '';
 }
 ?>
   <ul class="list_product clear">
     <li class="relative"><?php 
 echo $display_products_image;
 ?>
       
     </li>
Ejemplo n.º 7
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 : '' : '');
     break;
 case 'PRODUCT_LIST_QUANTITY':
     $lc_align = 'right';
     if ($listing->fields['products_quantity'] != '') {
         $trg_extra_val .= '<div class="product-qty">' . TABLE_HEADING_QUANTITY . ' : ' . $listing->fields['products_quantity'] . "</div>";
     }
     //$lst_lc_text = '<div class="product-qty">'.$listing->fields['products_quantity']."</div>";
     break;
 case 'PRODUCT_LIST_WEIGHT':
     $lc_align = 'right';
     if ($listing->fields['products_weight'] != '') {
         $trg_extra_val .= '<div class="product-weight">' . TABLE_HEADING_WEIGHT . ' : ' . $listing->fields['products_weight'] . '</div>';
     }
     //$lst_lc_text = '<div class="product-weight">'.$listing->fields['products_weight'].'</div>';
<!--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
?>
Ejemplo n.º 9
0
 function verifyCheckout()
 {
     global $gCommerceSystem;
     foreach ($this->contents as $productsKey => $productsHash) {
         $product = $this->getProductObject($productsKey);
         $check_quantity = $productsHash['products_quantity'];
         $check_quantity_min = $product->getField('products_quantity_order_min');
         // Check quantity min
         if ($new_check_quantity = $this->in_cart_mixed($productsKey)) {
             $check_quantity = $new_check_quantity;
         }
         $fix_once = 0;
         if ($check_quantity < $check_quantity_min) {
             $fix_once++;
             $this->mErrors['checkout'][$productsKey] = tra('Product: ') . $product->getTitle() . tra(' ... Quantity Units errors - ') . tra('You ordered a total of: ') . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display(zen_get_prid($productsKey), false, true) . '</span> ';
         }
         // Check Quantity Units if not already an error on Quantity Minimum
         if ($fix_once == 0) {
             $check_units = $product->getField('products_quantity_order_units');
             if (fmod($check_quantity, $check_units) != 0) {
                 $this->mErrors['checkout'][$productsKey] = tra('Product: ') . $product->getTitle() . tra(' ... Quantity Units errors - ') . tra('You ordered a total of: ') . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display(zen_get_prid($productsKey), false, true) . '</span> ';
             }
         }
         // Check if the required stock is available. If insufficent stock is available return an out of stock message
         if ($gCommerceSystem->getConfig('STOCK_CHECK') && !$gCommerceSystem->getConfig('STOCK_ALLOW_CHECKOUT')) {
             foreach ($this->contents as $productsKey => $productsHash) {
                 $product = $this->getProductObject($productsKey);
                 if (!$product->getField('products_quantity') && !$product->getField('products_virtual')) {
                     if ($gCommerceSystem->getConfig('STOCK_ALLOW_CHECKOUT')) {
                         $this->mErrors['checkout'][$productsKey] = tra('Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' are out of stock.<br />Items not in stock will be placed on backorder.');
                     } else {
                         $this->mErrors['checkout'][$productsKey] = tra('Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' are out of stock or there are not enough in stock to fill your order.<br />Please change the quantity of products marked with (' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '). Thank you');
                     }
                 }
             }
         }
     }
     return empty($this->mErrors['checkout']);
 }
     $lc_button = '';
     if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
         $lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     } else {
         if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
             if (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++;
             }
             $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } 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) . '</a>';
         }
     }
     $the_button = $lc_button;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     $lc_text .= '<br />' . (($advanced_stock_button = zen_addOnModules_call_function('advanced_stock', 'advanced_stock_get_buy_now_button', array($listing->fields['products_id'], $the_button, $products_link))) != '' ? $advanced_stock_button : 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':
     $lc_align = 'right';
     $lc_text = $listing->fields['products_weight'];
     break;
 case 'PRODUCT_LIST_IMAGE':
     $lc_align = 'center';
     if (isset($_GET['manufacturers_id'])) {
         $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT) . '</a>';
     } else {
Ejemplo n.º 11
0
 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 function get_products($check_for_valid_cart = false)
 {
     global $db;
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START');
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n                                  p.products_price,p.products_price_sample, p.products_weight, p.products_tax_class_id,\n                                  p.products_quantity_order_min, p.products_quantity_order_units,\n                                  p.product_is_free, p.products_priced_by_attribute,\n                                  p.products_discount_type, p.products_discount_type_from\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           where p.products_id = '" . (int) $products_id . "'\n                           and pd.products_id = p.products_id\n                           and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
         if ($products = $db->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             $products_price = $products->fields['products_price'] == 0 ? $products->fields['products_price_sample'] : $products->fields['products_price'];
             //fix here
             /*
             $special_price = zen_get_products_special_price($prid);
             if ($special_price) {
             $products_price = $special_price;
             }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 // reset for priced by attributes
                 //            $products_price = $products->fields['products_price'];
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 $categories_query = $db->Execute("SELECT categories_discount_type FROM " . TABLE_CATEGORIES . " WHERE categories_id = " . zen_get_products_category_id($products_id));
                 if ($products->fields['products_discount_type'] != 0 || $categories_query->fields['categories_discount_type'] != 0) {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $_SESSION['valid_to_checkout'] = false;
                     $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->remove($products_id);
                 }
                 // check only if valid products_status
                 if ($fix_once == 0) {
                     $check_quantity = $this->contents[$products_id]['qty'];
                     $check_quantity_min = $products->fields['products_quantity_order_min'];
                     // Check quantity min
                     if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                         $check_quantity = $new_check_quantity;
                     }
                 }
                 if ($fix_once == 0) {
                     if ($check_quantity < $check_quantity_min) {
                         $fix_once++;
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Check Quantity Units if not already an error on Quantity Minimum
                 if ($fix_once == 0) {
                     $check_units = $products->fields['products_quantity_order_units'];
                     if (fmod_round($check_quantity, $check_units) != 0) {
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Verify Valid Attributes
             }
             //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
             // convert quantity to proper decimals
             if (QUANTITY_DECIMALS != 0) {
                 //          $new_qty = round($new_qty, QUANTITY_DECIMALS);
                 $fix_qty = $this->contents[$products_id]['qty'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
                         $new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
                         break;
                 }
             } else {
                 $new_qty = $this->contents[$products_id]['qty'];
             }
             $check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
             if (strstr($check_unit_decimals, '.')) {
                 $new_qty = round($new_qty, QUANTITY_DECIMALS);
             } else {
                 $new_qty = round($new_qty, 0);
             }
             if ($new_qty == (int) $new_qty) {
                 $new_qty = (int) $new_qty;
             }
             $products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
         }
     }
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_END');
     return $products_array;
 }
Ejemplo n.º 12
0
function zproduct_add_btn($a1, $a2)
{
    echo zen_get_products_quantity_min_units_display((int) $_GET['products_id']) . zen_draw_hidden_field('products_id', (int) $_GET['products_id']) . zen_image_submit($a1, $a2);
}
            }
        }
        $products_name .= '    </td>' . '  </tr>' . '</table>';
        $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"', 'text' => $products_name);
        $show_products_quantity_max = zen_get_products_quantity_order_max($products[$i]['id']);
        if ($show_products_quantity_max == 1 or zen_get_products_qty_box_status($products[$i]['id']) == 0) {
            if (SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) {
                $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="middle"', 'text' => $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1) . '<br />' . zen_get_products_quantity_min_units_display((int) $products[$i]['id']) . '<br />' . zen_image_submit(BUTTON_IMAGE_UPDATE_CART, BUTTON_UPDATE_CART_ALT));
            } else {
                $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="middle"', 'text' => $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1) . '<br />' . zen_get_products_quantity_min_units_display((int) $products[$i]['id']));
            }
        } else {
            if (SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) {
                $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="middle"', 'text' => zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . '<br />' . zen_image_submit(BUTTON_IMAGE_UPDATE_CART, BUTTON_UPDATE_CART_ALT) . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . '<br />' . zen_get_products_quantity_min_units_display((int) $products[$i]['id']));
            } else {
                $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="middle"', 'text' => zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . '<br />' . zen_get_products_quantity_min_units_display((int) $products[$i]['id']));
            }
        }
        $info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="middle"', 'text' => '<span class="cartproductprice">' . $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) : '') . '</span>');
    }
    new productListingBox($info_box_contents);
    ?>
    </td>
  </tr>
  <tr>
    <td class="main" colspan="3"><?php 
    echo zen_draw_separator(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_SILVER_SEPARATOR, '100%', '1');
    ?>
</td>
  </tr>
  <tr>
?>
						</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>
			</div>
		</div>
	
	</div>
Ejemplo n.º 15
0
 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 function get_products($check_for_valid_cart = false)
 {
     global $db;
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START', array(), $check_for_valid_cart);
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n/* Dual Pricing start */\n                                  p.products_price, p.products_price_w, p.products_weight, p.products_tax_class_id,\n/* Dual Pricing end */\n                                  p.products_quantity_order_min, p.products_quantity_order_units, p.products_quantity_order_max,\n                                  p.product_is_free, p.products_priced_by_attribute,\n                                  p.products_discount_type, p.products_discount_type_from, p.products_virtual, p.product_is_always_free_shipping\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           where p.products_id = '" . (int) $products_id . "'\n                           and pd.products_id = p.products_id\n                           and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
         if ($products = $db->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             // Dual Pricing start
             if ($_SESSION['customer_id']) {
                 $customers_id = $_SESSION['customer_id'];
                 $customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '{$customers_id}'");
                 if ($customer_check->fields['customers_whole'] != "0") {
                     $i = $customer_check->fields['customers_whole'];
                     $i--;
                     $products_price_array = $products->fields['products_price_w'];
                     $productsprice = explode("-", $products_price_array);
                     $products_price = (double) $productsprice[$i];
                     if ($products_price == '0' || $products_price == '') {
                         $products_price = (double) $productsprice[0];
                     }
                     if ($products_price == '0') {
                         $products_price = $products->fields['products_price'];
                     }
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 $products_price = $products->fields['products_price'];
             }
             // Dual Pricing end
             //fix here
             /*
             $special_price = zen_get_products_special_price($prid);
             if ($special_price) {
             $products_price = $special_price;
             }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 // reset for priced by attributes
                 //            $products_price = $products->fields['products_price'];
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 if ($products->fields['products_discount_type'] != '0') {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $_SESSION['valid_to_checkout'] = false;
                     $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->remove($products_id);
                 } else {
                     if (isset($this->contents[$products_id]['attributes'])) {
                         reset($this->contents[$products_id]['attributes']);
                         $chkcount = 0;
                         while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
                             $chkcount++;
                             $chk_attributes_exist_query = "select products_id\n                                          from " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                          where pa.products_id = '" . (int) $products_id . "'\n                                          and pa.options_values_id = '" . (int) $value . "'";
                             $chk_attributes_exist = $db->Execute($chk_attributes_exist_query);
                             //echo 'what is it: ' . ' : ' . $products_id . ' - ' . $value . ' records: ' . $chk_attributes_exist->RecordCount() . ' vs ' . print_r($this->contents[$products_id]) . '<br>';
                             if ($chk_attributes_exist->EOF) {
                                 $fix_once++;
                                 $_SESSION['valid_to_checkout'] = false;
                                 $chk_product_attributes = $db->Execute("SELECT products_status FROM " . TABLE_PRODUCTS . " WHERE products_status = 1 and products_id = '" . $products->fields["products_id"] . "' limit 1");
                                 if (!$chk_product_attributes->EOF && $chk_product_attributes->fields['products_status'] == 1) {
                                     $chk_products_link = '<a href="' . zen_href_link(zen_get_info_page($products->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($products->fields["master_categories_id"]) . '&products_id=' . $products->fields["products_id"]) . '">' . $products->fields['products_name'] . '</a>';
                                 } else {
                                     $chk_products_link = $products->fields['products_name'];
                                 }
                                 $_SESSION['cart_errors'] .= ERROR_PRODUCT_ATTRIBUTES . $chk_products_link . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
                                 $this->remove($products_id);
                                 break;
                             }
                         }
                     }
                 }
                 // check only if valid products_status
                 if ($fix_once == 0) {
                     $check_quantity = $this->contents[$products_id]['qty'];
                     $check_quantity_min = $products->fields['products_quantity_order_min'];
                     // Check quantity min
                     if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                         $check_quantity = $new_check_quantity;
                     }
                 }
                 // Check Quantity Max if not already an error on Minimum
                 if ($fix_once == 0) {
                     if ($products->fields['products_quantity_order_max'] != 0 && $check_quantity > $products->fields['products_quantity_order_max']) {
                         $fix_once++;
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MAX_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 if ($fix_once == 0) {
                     if ($check_quantity < $check_quantity_min) {
                         $fix_once++;
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Check Quantity Units if not already an error on Quantity Minimum
                 if ($fix_once == 0) {
                     $check_units = $products->fields['products_quantity_order_units'];
                     if (fmod_round($check_quantity, $check_units) != 0) {
                         $_SESSION['valid_to_checkout'] = false;
                         $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                     }
                 }
                 // Verify Valid Attributes
             }
             //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
             // convert quantity to proper decimals
             if (QUANTITY_DECIMALS != 0) {
                 //          $new_qty = round($new_qty, QUANTITY_DECIMALS);
                 $fix_qty = $this->contents[$products_id]['qty'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
                         $new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
                         break;
                 }
             } else {
                 $new_qty = $this->contents[$products_id]['qty'];
             }
             $check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
             if (strstr($check_unit_decimals, '.')) {
                 $new_qty = round($new_qty, QUANTITY_DECIMALS);
             } else {
                 $new_qty = round($new_qty, 0);
             }
             //@@TODO - should be okay to remove
             if (false && $new_qty == (int) $new_qty) {
                 $new_qty = (int) $new_qty;
             }
             $products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from'], 'products_virtual' => $products->fields['products_virtual'], 'product_is_always_free_shipping' => $products->fields['product_is_always_free_shipping']);
         }
     }
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_END', array(), $products_array);
     return $products_array;
 }
Ejemplo n.º 16
0
 /**
  * Method to return details of all products in the cart
  *
  * @param boolean whether to check if cart contents are valid
  * @return array
  */
 public function get_products($check_for_valid_cart = false)
 {
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_START');
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,\n                p.products_price, p.products_weight, p.products_tax_class_id,\n                p.products_quantity_order_min, p.products_quantity_order_units, p.products_quantity_order_max,\n                p.product_is_free, p.products_priced_by_attribute,\n                p.products_discount_type, p.products_discount_type_from\n                from %table.products% p, %table.products_description% pd\n                where p.products_id = '" . (int) $products_id . "'\n                and pd.products_id = p.products_id\n                and pd.language_id = '" . (int) $this->getSessionVar('languages_id') . "'";
         if ($products = $this->getDb()->Execute($products_query)) {
             $prid = $products->fields['products_id'];
             $products_price = $products->fields['products_price'];
             //fix here
             /*
                     $special_price = zen_get_products_special_price($prid);
                     if ($special_price) {
                     $products_price = $special_price;
                     }
             */
             $special_price = zen_get_products_special_price($prid);
             if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
                 $products_price = $special_price;
             } else {
                 $special_price = 0;
             }
             if (zen_get_products_price_is_free($products->fields['products_id'])) {
                 // no charge
                 $products_price = 0;
             }
             // adjust price for discounts when priced by attribute
             if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
                 if ($special_price) {
                     $products_price = $special_price;
                 } else {
                     $products_price = $products->fields['products_price'];
                 }
             } else {
                 // discount qty pricing
                 if ($products->fields['products_discount_type'] != '0') {
                     $products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $this->contents[$products_id]['qty']);
                 }
             }
             // validate cart contents for checkout
             if ($check_for_valid_cart == true) {
                 $fix_once = 0;
                 // Check products_status if not already
                 $check_status = $products->fields['products_status'];
                 if ($check_status == 0) {
                     $fix_once++;
                     $this->setSessionVar('valid_to_checkout', false);
                     $cart_errors = $this->getSessionVar('cart_errors');
                     $cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART . '<br />';
                     $this->setSessionVar('cart_errors', $cart_errors);
                     $this->remove($products_id);
                 } else {
                     if (isset($this->contents[$products_id]['attributes'])) {
                         reset($this->contents[$products_id]['attributes']);
                         $chkcount = 0;
                         while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
                             $chkcount++;
                             $chk_attributes_exist_query = "select products_id\n                                    from %table.products_attributes% pa\n                                    where pa.products_id = '" . (int) $products_id . "'\n                                    and pa.options_values_id = '" . (int) $value . "'";
                             $chk_attributes_exist = $this->getDb()->Execute($chk_attributes_exist_query);
                             if ($chk_attributes_exist->EOF) {
                                 $fix_once++;
                                 $this->setSessionVar('valid_to_checkout', false);
                                 $cart_errors = $this->getSessionVar('cart_errors');
                                 $cart_errors .= ERROR_PRODUCT_ATTRIBUTES . $products->fields['products_name'] . ERROR_PRODUCT_STATUS_SHOPPING_CART_ATTRIBUTES . '<br />';
                                 $this->setSessionVar('cart_errors', $cart_errors);
                                 $this->remove($products_id);
                                 break;
                             }
                         }
                     }
                 }
                 // check only if valid products_status
                 if ($fix_once == 0) {
                     $check_quantity = $this->contents[$products_id]['qty'];
                     $check_quantity_min = $products->fields['products_quantity_order_min'];
                     // Check quantity min
                     if ($new_check_quantity = $this->in_cart_mixed($prid)) {
                         $check_quantity = $new_check_quantity;
                     }
                 }
                 // Check Quantity Max if not already an error on Minimum
                 if ($fix_once == 0) {
                     if ($products->fields['products_quantity_order_max'] != 0 && $check_quantity > $products->fields['products_quantity_order_max']) {
                         $fix_once++;
                         $this->setSessionVar('valid_to_checkout', false);
                         $cart_errors = $this->getSessionVar('cart_errors');
                         $cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MAX_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                         $this->setSessionVar('cart_errors', $cart_errors);
                     }
                 }
                 if ($fix_once == 0) {
                     if ($check_quantity < $check_quantity_min) {
                         $fix_once++;
                         $this->setSessionVar('valid_to_checkout', false);
                         $cart_errors = $this->getSessionVar('cart_errors');
                         $cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_MIN_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                         $this->setSessionVar('cart_errors', $cart_errors);
                     }
                 }
                 // Check Quantity Units if not already an error on Quantity Minimum
                 if ($fix_once == 0) {
                     $check_units = $products->fields['products_quantity_order_units'];
                     if (fmod_round($check_quantity, $check_units) != 0) {
                         $this->setSessionVar('valid_to_checkout', false);
                         $cart_errors = $this->getSessionVar('cart_errors');
                         $cart_errors .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int) $prid, false, true) . '</span> ' . '<br />';
                         $this->setSessionVar('cart_errors', $cart_errors);
                     }
                 }
                 // Verify Valid Attributes
             }
             //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
             // convert quantity to proper decimals
             if (QUANTITY_DECIMALS != 0) {
                 $fix_qty = $this->contents[$products_id]['qty'];
                 switch (true) {
                     case !strstr($fix_qty, '.'):
                         $new_qty = $fix_qty;
                         break;
                     default:
                         $new_qty = preg_replace('/[0]+$/', '', $this->contents[$products_id]['qty']);
                         break;
                 }
             } else {
                 $new_qty = $this->contents[$products_id]['qty'];
             }
             $check_unit_decimals = zen_get_products_quantity_order_units((int) $products->fields['products_id']);
             if (strstr($check_unit_decimals, '.')) {
                 $new_qty = round($new_qty, QUANTITY_DECIMALS);
             } else {
                 $new_qty = round($new_qty, 0);
             }
             if ($new_qty == (int) $new_qty) {
                 $new_qty = (int) $new_qty;
             }
             $products_array[] = array('id' => $products_id, 'category' => $products->fields['master_categories_id'], 'name' => $products->fields['products_name'], 'model' => $products->fields['products_model'], 'image' => $products->fields['products_image'], 'price' => $products->fields['product_is_free'] == '1' ? 0 : $products_price, 'quantity' => $new_qty, 'weight' => $products->fields['products_weight'] + $this->attributes_weight($products_id), 'final_price' => $products_price + $this->attributes_price($products_id), 'onetime_charges' => $this->attributes_price_onetime_charges($products_id, $new_qty), 'tax_class_id' => $products->fields['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '', 'attributes_values' => isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '', 'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'], 'product_is_free' => $products->fields['product_is_free'], 'products_discount_type' => $products->fields['products_discount_type'], 'products_discount_type_from' => $products->fields['products_discount_type_from']);
         }
     }
     $this->notify('NOTIFIER_CART_GET_PRODUCTS_END');
     return $products_array;
 }
Ejemplo n.º 17
0
            $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:
$zco_notifier->notify('NOTIFY_HEADER_END_SHOPPING_CART');
 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;
 }
<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
             if (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++;
             }
             $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
         } 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) . '</a>';
         }
     }
     $the_button = $lc_button;
     $products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
     // -> zen_smartphone: <br />がジャマ。必要なら出すように変更
     //          $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 />' : '') : '');
     $add_lc_text_list = array();
     $add_lc_text_list[] = zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link);
     $add_lc_text_list[] = zen_get_products_quantity_min_units_display($listing->fields['products_id']);
     $add_lc_text_list[] = 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 />' : '' : '';
     foreach ($add_lc_text_list as $add_lc_text) {
         if ($add_lc_text == '') {
             continue;
         }
         $lc_text .= '<br />' . $add_lc_text;
     }
     // <- zen_smartphone: <br />がジャマ。必要なら出すように変更
     break;
 case 'PRODUCT_LIST_QUANTITY':
     $lc_align = 'right';
     $lc_text = $listing->fields['products_quantity'];
     break;
 case 'PRODUCT_LIST_WEIGHT':
     $lc_align = 'right';