当前位置: 首页>>代码示例>>PHP>>正文


PHP osC_Product::isGiftCertificate方法代码示例

本文整理汇总了PHP中osC_Product::isGiftCertificate方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_Product::isGiftCertificate方法的具体用法?PHP osC_Product::isGiftCertificate怎么用?PHP osC_Product::isGiftCertificate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osC_Product的用法示例。


在下文中一共展示了osC_Product::isGiftCertificate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 function execute()
 {
     global $osC_Session, $osC_ShoppingCart, $osC_Product, $osC_Language, $messageStack, $toC_Customization_Fields;
     if (!isset($osC_Product)) {
         $id = false;
         foreach ($_GET as $key => $value) {
             if ((ereg('^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if (strpos($id, '_') !== false) {
             $id = str_replace('_', '#', $id);
         }
         if ($id !== false && osC_Product::checkEntry($id)) {
             $osC_Product = new osC_Product($id);
         }
     }
     if (isset($osC_Product)) {
         //customization fields check
         if ($osC_Product->hasRequiredCustomizationFields()) {
             if (!$toC_Customization_Fields->exists($osC_Product->getID())) {
                 $osC_Language->load('products');
                 $messageStack->add_session('products', $osC_Language->get('error_customization_fields_missing'), 'error');
                 osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
             }
         }
         $variants = null;
         if (isset($_POST['variants']) && is_array($_POST['variants'])) {
             $variants = $_POST['variants'];
         } else {
             if (isset($_GET['variants']) && !empty($_GET['variants'])) {
                 $variants = osc_parse_variants_string($_GET['variants']);
             }
         }
         $gift_certificate_data = null;
         if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) {
             if ($osC_Product->isEmailGiftCertificate()) {
                 $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']);
             } else {
                 $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']);
             }
             if ($osC_Product->isOpenAmountGiftCertificate()) {
                 $gift_certificate_data['price'] = $_POST['gift_certificate_amount'];
             }
             $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType();
         }
         $quantity = null;
         if (isset($_POST['quantity']) && is_numeric($_POST['quantity'])) {
             $quantity = $_POST['quantity'];
         }
         if ($osC_Product->isGiftCertificate() && $gift_certificate_data == null) {
             osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
             return false;
         } else {
             $osC_ShoppingCart->add($osC_Product->getID(), $variants, $quantity, $gift_certificate_data);
         }
     }
     osc_redirect(osc_href_link(FILENAME_CHECKOUT));
 }
开发者ID:4DvAnCeBoY,项目名称:tomatocart-shoppingcart,代码行数:60,代码来源:cart_add.php

示例2: execute

 function execute()
 {
     global $osC_Session, $osC_ShoppingCart, $osC_Product;
     if (!isset($osC_Product)) {
         $id = false;
         foreach ($_GET as $key => $value) {
             if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
                 $id = $key;
             }
             break;
         }
         if ($id !== false && osC_Product::checkEntry($id)) {
             $osC_Product = new osC_Product($id);
         }
     }
     if (isset($osC_Product)) {
         $variants = null;
         if (isset($_POST['variants']) && is_array($_POST['variants'])) {
             $variants = $_POST['variants'];
         } else {
             if (isset($_GET['variants']) && !empty($_GET['variants'])) {
                 $variants = osc_parse_variants_string($_GET['variants']);
             }
         }
         $gift_certificate_data = null;
         if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) {
             if ($osC_Product->isEmailGiftCertificate()) {
                 $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']);
             } else {
                 $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']);
             }
             if ($osC_Product->isOpenAmountGiftCertificate()) {
                 $gift_certificate_data['price'] = $_POST['gift_certificate_amount'];
             }
             $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType();
         }
         $quantity = null;
         if (isset($_POST['quantity']) && is_numeric($_POST['quantity'])) {
             $quantity = $_POST['quantity'];
         }
         if ($osC_Product->hasVariants() && empty($variants) || $osC_Product->isGiftCertificate() && $gift_certificate_data == null) {
             osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
             return false;
         } else {
             $osC_ShoppingCart->add($osC_Product->getID(), $variants, $quantity, $gift_certificate_data);
         }
     }
     osc_redirect(osc_href_link(FILENAME_CHECKOUT));
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:49,代码来源:cart_add.php

示例3: execute

 function execute()
 {
     global $osC_ShoppingCart;
     if (isset($_POST['products']) && is_array($_POST['products']) && !empty($_POST['products'])) {
         foreach ($_POST['products'] as $product => $quantity) {
             if (!is_numeric($quantity)) {
                 return false;
             }
             $product = explode('#', $product, 2);
             $variants_array = array();
             if (isset($product[1])) {
                 $variants = explode(';', $product[1]);
                 foreach ($variants as $set) {
                     $variant = explode(':', $set);
                     if (is_numeric($variant[0]) && is_numeric($variant[1])) {
                         $variants_array[$variant[0]] = $variant[1];
                     }
                 }
             }
             $osC_Product = new osC_Product($product[0]);
             if ($osC_Product->isGiftCertificate()) {
                 $variants_array = $product[1];
             }
             $osC_ShoppingCart->add($product[0], $variants_array, $quantity, null, 'update');
         }
     }
     osc_redirect(osc_href_link(FILENAME_CHECKOUT));
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:28,代码来源:cart_update.php

示例4: execute

 function execute()
 {
     global $osC_Session, $osC_ShoppingCart;
     $id = false;
     foreach ($_GET as $key => $value) {
         if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) {
             $id = $key;
         }
         break;
     }
     if ($id !== false && osC_Product::checkEntry($id)) {
         $osC_Product = new osC_Product($id);
         $product_id = $osC_Product->getID();
         //gift certificate use timestamp as variant
         if ($osC_Product->isGiftCertificate()) {
             $product_id .= '#' . $_GET['variants'];
         } else {
             if (isset($_GET['variants']) && ereg('^([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*$', $_GET['variants'])) {
                 $product_id .= '#' . $_GET['variants'];
             }
         }
         $osC_ShoppingCart->remove($product_id);
     }
     osc_redirect(osc_href_link(FILENAME_CHECKOUT));
 }
开发者ID:sajad1441,项目名称:TomatoShop-v1,代码行数:25,代码来源:cart_remove.php

示例5: addProduct

 function addProduct()
 {
     global $osC_ShoppingCart, $toC_Json, $osC_Language, $toC_Customization_Fields;
     $osC_Language->load('products');
     if (is_numeric($_REQUEST['pID']) && osC_Product::checkEntry($_REQUEST['pID'])) {
         $osC_ShoppingCart->resetShippingMethod();
         $osC_Product = new osC_Product($_REQUEST['pID']);
         //gift certificate check
         if ($osC_Product->isGiftCertificate() && !isset($_POST['senders_name'])) {
             $response = array('success' => false, 'feedback' => $osC_Language->get('error_gift_certificate_data_missing'));
         } else {
             if ($osC_Product->hasRequiredCustomizationFields() && !$toC_Customization_Fields->exists($osC_Product->getID())) {
                 $response = array('success' => false, 'feedback' => $osC_Language->get('error_customization_fields_missing'));
             } else {
                 $variants = null;
                 if (isset($_REQUEST['variants']) && !empty($_REQUEST['variants'])) {
                     $variants = osc_parse_variants_string($_REQUEST['variants']);
                 }
                 $gift_certificate_data = null;
                 if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) {
                     if ($osC_Product->isEmailGiftCertificate()) {
                         $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']);
                     } else {
                         $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']);
                     }
                     if ($osC_Product->isOpenAmountGiftCertificate()) {
                         $gift_certificate_data['price'] = $_POST['gift_certificate_amount'];
                     }
                     $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType();
                 }
                 $osC_ShoppingCart->add($_REQUEST['pID'], $variants, $_REQUEST['pQty'], $gift_certificate_data);
                 $content = self::_getShoppingCart();
                 $response = array('success' => true, 'content' => $content);
             }
         }
     } else {
         $response = array('success' => false);
     }
     echo $toC_Json->encode($response);
 }
开发者ID:4DvAnCeBoY,项目名称:tomatocart-shoppingcart,代码行数:40,代码来源:ajax_shopping_cart.php

示例6: addProduct

 function addProduct()
 {
     global $toC_Json, $osC_Language, $osC_Tax, $osC_Weight, $osC_Currencies, $osC_ShoppingCart;
     $error = false;
     $feedback = array();
     $osC_ShoppingCart = new toC_ShoppingCart_Adapter($_REQUEST['orders_id']);
     $osC_Tax = new osC_Tax_Admin();
     $osC_Weight = new osC_Weight();
     $osC_Currencies = new osC_Currencies();
     $osC_Product = new osC_Product(osc_get_product_id($_REQUEST['products_id']));
     $gift_certificate_data = null;
     if ($osC_Product->isGiftCertificate()) {
         if (!isset($_REQUEST['senders_name']) || empty($_REQUEST['senders_name'])) {
             $error = true;
             $feedback[] = $osC_Language->get('error_sender_name_empty');
         }
         if (!isset($_REQUEST['recipients_name']) || empty($_REQUEST['recipients_name'])) {
             $error = true;
             $feedback[] = $osC_Language->get('error_recipients_name_empty');
         }
         if (!isset($_REQUEST['message']) || empty($_REQUEST['message'])) {
             $error = true;
             $feedback[] = $osC_Language->get('error_message_empty');
         }
         if ($osC_Product->isEmailGiftCertificate()) {
             if (!isset($_REQUEST['senders_email']) || empty($_REQUEST['senders_email'])) {
                 $error = true;
                 $feedback[] = $osC_Language->get('error_sender_email_empty');
             }
             if (!osc_validate_email_address($_REQUEST['senders_email'])) {
                 $error = true;
                 $feedback[] = $osC_Language->get('error_sender_email_invalid');
             }
             if (!isset($_REQUEST['recipients_email']) || empty($_REQUEST['recipients_email'])) {
                 $error = true;
                 $feedback[] = $osC_Language->get('error_recipients_email_empty');
             }
             if (!osc_validate_email_address($_REQUEST['recipients_email'])) {
                 $error = true;
                 $feedback[] = $osC_Language->get('error_recipients_email_invalid');
             }
         }
         if ($error === false) {
             if ($osC_Product->isEmailGiftCertificate()) {
                 $gift_certificate_data = array('senders_name' => $_REQUEST['senders_name'], 'senders_email' => $_REQUEST['senders_email'], 'recipients_name' => $_REQUEST['recipients_name'], 'recipients_email' => $_REQUEST['recipients_email'], 'message' => $_REQUEST['message']);
             } else {
                 $gift_certificate_data = array('senders_name' => $_REQUEST['senders_name'], 'recipients_name' => $_REQUEST['recipients_name'], 'message' => $_REQUEST['message']);
             }
             $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType();
             if ($osC_Product->isOpenAmountGiftCertificate()) {
                 $gift_certificate_data['price'] = $_REQUEST['gift_certificate_amount'] / $osC_ShoppingCart->getCurrencyValue();
             }
         }
     }
     if ($error === false) {
         if ($osC_ShoppingCart->addProduct($_REQUEST['products_id'], $_REQUEST['new_qty'], $gift_certificate_data)) {
             $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
         } else {
             $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
         }
     } else {
         $response = array('success' => false, 'feedback' => implode('<br />', $feedback));
     }
     echo $toC_Json->encode($response);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:65,代码来源:orders.php

示例7: addProduct

 function addProduct()
 {
     global $osC_ShoppingCart, $toC_Json, $osC_Language, $toC_Customization_Fields, $osC_Image, $osC_Currencies;
     $osC_Language->load('products');
     if (is_numeric($_POST['pID']) && osC_Product::checkEntry($_POST['pID'])) {
         $osC_ShoppingCart->resetShippingMethod();
         $osC_Product = new osC_Product($_POST['pID']);
         //gift certificate check
         if ($osC_Product->isGiftCertificate() && !isset($_POST['senders_name'])) {
             $response = array('success' => false, 'feedback' => $osC_Language->get('error_gift_certificate_data_missing'));
         } else {
             if ($osC_Product->hasRequiredCustomizationFields() && !$toC_Customization_Fields->exists($osC_Product->getID())) {
                 $response = array('success' => false, 'feedback' => $osC_Language->get('error_customization_fields_missing'));
             } else {
                 $variants = null;
                 if (isset($_POST['variants']) && !empty($_POST['variants'])) {
                     $variants = osc_parse_variants_string($_POST['variants']);
                 }
                 $gift_certificate_data = null;
                 if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) {
                     if ($osC_Product->isEmailGiftCertificate()) {
                         $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']);
                     } else {
                         $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']);
                     }
                     if ($osC_Product->isOpenAmountGiftCertificate()) {
                         $gift_certificate_data['price'] = $_POST['gift_certificate_amount'];
                     }
                     $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType();
                 }
                 $osC_ShoppingCart->add($_POST['pID'], $variants, $_POST['pQty'], $gift_certificate_data);
                 $items = 0;
                 foreach ($osC_ShoppingCart->getProducts() as $products_id => $data) {
                     $items += $data['quantity'];
                 }
                 //build the content of the confirmation dialog
                 $product_id_string = osc_get_product_id_string($_POST['pID'], $variants);
                 //find the added product
                 $added_product = null;
                 foreach ($osC_ShoppingCart->getProducts() as $id_string => $product) {
                     if ($product_id_string == $id_string) {
                         $added_product = $product;
                         break;
                     }
                 }
                 //build the dialog
                 $confirm_dialog = null;
                 if ($added_product !== null) {
                     $confirm_dialog .= '<div class="dlgConfirm">' . '<div class="itemImage">' . $osC_Image->show($added_product['image'], $added_product['name'], '', 'thumbnail') . '</div>' . '<div class="itemDetail"><p>' . sprintf($osC_Language->get('add_to_cart_confirmation'), $added_product['quantity'] . ' x ' . osc_link_object(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'), $added_product['name']));
                     //gift certificates
                     if ($added_product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                         $confirm_dialog .= '<br />- ' . $osC_Language->get('senders_name') . ': ' . $product['gc_data']['senders_name'];
                         if ($added_product['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                             $confirm_dialog .= '<br />- ' . $osC_Language->get('senders_email') . ': ' . $product['gc_data']['senders_email'];
                         }
                         $confirm_dialog .= '<br />- ' . $osC_Language->get('recipients_name') . ': ' . $product['gc_data']['recipients_name'];
                         if ($added_product['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                             $confirm_dialog .= '<br />- ' . $osC_Language->get('recipients_email') . ': ' . $product['gc_data']['recipients_email'];
                         }
                         $confirm_dialog .= '<br />- ' . $osC_Language->get('message') . ': ' . $product['gc_data']['message'];
                     }
                     $confirm_dialog .= '</p>';
                     //variants products
                     if ($osC_ShoppingCart->hasVariants($product['id'])) {
                         foreach ($osC_ShoppingCart->getVariants($product['id']) as $variants) {
                             $confirm_dialog .= '<div>';
                             $confirm_dialog .= '<strong>' . $variants['groups_name'] . ' - </strong><strong>' . $variants['values_name'] . '</strong></tr>';
                             $confirm_dialog .= '</div>';
                         }
                     }
                     $confirm_dialog .= '</div>';
                     //cart total
                     $confirm_dialog .= '<p><strong>' . $osC_ShoppingCart->numberOfItems() . ' ' . $osC_Language->get('text_items') . '</strong> - <strong>' . $osC_Currencies->format($osC_ShoppingCart->getTotal()) . '</strong></p>';
                     //bottom buttons
                     $confirm_dialog .= '<div class="btns">' . osc_link_object(osc_href_link(FILENAME_CHECKOUT, 'checkout', 'SSL'), osc_draw_image_button('button_checkout.gif', $osC_Language->get('button_checkout'))) . osc_link_object(osc_href_link(FILENAME_CHECKOUT, 'cart', 'SSL'), osc_draw_image_button('button_ajax_cart.png')) . osc_link_object(osc_href_link(FILENAME_DEFAULT), osc_draw_image_button('button_continue.gif'), 'id="btnContinue"') . '</div>';
                     $confirm_dialog .= '</div>';
                 }
                 $response = array('success' => true, 'items' => $items, 'confirm_dialog' => $confirm_dialog);
             }
         }
     } else {
         $response = array('success' => false);
     }
     echo $toC_Json->encode($response);
 }
开发者ID:ellipsonic,项目名称:tomato_app,代码行数:85,代码来源:popup_cart.php

示例8: add

 function add($products_id_string, $variants = null, $quantity = null, $gift_certificates_data = null, $action = 'add')
 {
     global $osC_Database, $osC_Services, $osC_Language, $osC_Customer, $osC_Image, $toC_Wishlist;
     $products_id = osc_get_product_id($products_id_string);
     $osC_Product = new osC_Product($products_id);
     if ($osC_Product->isGiftCertificate()) {
         if ($variants == null || empty($variants)) {
             $products_id_string = $products_id . '#' . time();
         } else {
             $products_id_string = $products_id . '#' . $variants;
             //set variants to null
             $variants = null;
         }
     } else {
         $products_id_string = osc_get_product_id_string($products_id_string, $variants);
     }
     if ($osC_Product->getID() > 0) {
         if ($toC_Wishlist->hasProduct($products_id)) {
             $toC_Wishlist->deleteProduct($products_id);
         }
         if ($this->exists($products_id_string)) {
             if (!is_numeric($quantity)) {
                 $quantity = $this->getQuantity($products_id_string) + 1;
             } else {
                 if (is_numeric($quantity) && $quantity == 0) {
                     $this->remove($products_id_string);
                     return;
                 } else {
                     if ($action == 'add') {
                         $quantity = $this->getQuantity($products_id_string) + $quantity;
                     } else {
                         if ($action == 'update') {
                             $quantity = $quantity;
                         }
                     }
                 }
             }
             if ($osC_Product->isGiftCertificate()) {
                 if ($quantity > 1) {
                     $quantity = 1;
                     $error = $osC_Language->get('error_gift_certificate_quantity_must_be_one');
                 }
             }
             //check minimum order quantity
             $products_moq = $osC_Product->getMOQ();
             if ($quantity < $products_moq) {
                 $quantity = $products_moq;
                 $error = sprintf($osC_Language->get('error_minimum_order_quantity'), $osC_Product->getTitle(), $products_moq);
             }
             //check maximum order quantity
             $products_max_order_quantity = $osC_Product->getMaxOrderQuantity();
             if ($products_max_order_quantity > 0) {
                 if ($quantity > $products_max_order_quantity) {
                     $quantity = $products_max_order_quantity;
                     $error = sprintf($osC_Language->get('error_maximum_order_quantity'), $osC_Product->getTitle(), $products_max_order_quantity);
                 }
             }
             //check order increment
             $increment = $osC_Product->getOrderIncrement();
             if (($quantity - $products_moq) % $increment != 0) {
                 $quantity = $products_moq + (floor(($quantity - $products_moq) / $increment) + 1) * $increment;
                 $error = sprintf($osC_Language->get('error_order_increment'), $osC_Product->getTitle(), $increment);
             }
             //set error to session
             if (isset($error) && !empty($error)) {
                 $this->_contents[$products_id_string]['error'] = $error;
             }
             if ($osC_Product->isGiftCertificate() && $osC_Product->isOpenAmountGiftCertificate()) {
                 $price = $this->_contents[$products_id_string]['price'];
             } else {
                 $price = $osC_Product->getPrice($variants, $quantity);
                 if ($osC_Services->isStarted('specials')) {
                     global $osC_Specials;
                     if ($new_price = $osC_Specials->getPrice($products_id)) {
                         $price = $new_price;
                     }
                 }
             }
             $this->_contents[$products_id_string]['quantity'] = $quantity;
             $this->_contents[$products_id_string]['price'] = $price;
             $this->_contents[$products_id_string]['final_price'] = $price;
             // update database
             if ($osC_Customer->isLoggedOn()) {
                 $Qupdate = $osC_Database->query('update :table_customers_basket set customers_basket_quantity = :customers_basket_quantity, gift_certificates_data = :gift_certificates_data where customers_id = :customers_id and products_id = :products_id');
                 $Qupdate->bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
                 $Qupdate->bindInt(':customers_basket_quantity', $quantity);
                 if ($osC_Product->getProductType() == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $Qupdate->bindValue(':gift_certificates_data', serialize($gift_certificates_data));
                 } else {
                     $Qupdate->bindRaw(':gift_certificates_data', 'null');
                 }
                 $Qupdate->bindInt(':customers_id', $osC_Customer->getID());
                 $Qupdate->bindValue(':products_id', $products_id_string);
                 $Qupdate->execute();
             }
         } else {
             if (!is_numeric($quantity)) {
                 $quantity = 1;
             }
             if ($osC_Product->isGiftCertificate()) {
//.........这里部分代码省略.........
开发者ID:Doluci,项目名称:tomatocart,代码行数:101,代码来源:shopping_cart.php

示例9: array

 function _getShoppingCart()
 {
     global $osC_ShoppingCart, $osC_Currencies, $osC_Specials, $osC_Language;
     $cart = array();
     //products
     $products = array();
     foreach ($osC_ShoppingCart->getProducts() as $products_id_string => $data) {
         $osC_Product = new osC_Product(osc_get_product_id($products_id_string));
         $product = explode('#', $products_id_string, 2);
         $variants_array = array();
         if (!$osC_Product->isGiftCertificate()) {
             if (isset($product[1])) {
                 $variants = explode(';', $product[1]);
                 foreach ($variants as $set) {
                     $variant = explode(':', $set);
                     if (!is_numeric($variant[0]) || !is_numeric($variant[1])) {
                         continue 2;
                         // skip product
                     }
                     $variants_array[$variant[0]] = $variant[1];
                 }
             }
         }
         $price = $osC_Product->getPrice($variants_array, $data['quantity']);
         if ($osC_Product->hasSpecial()) {
             $special_price = $osC_Specials->getPrice($osC_Product->getID());
             if ($osC_Product->hasVariants()) {
                 $special_percentage = $special_price / $osC_Product->getData('price');
                 $special_price = $price * $special_percentage;
             }
             $price = '<s>' . $osC_Currencies->displayPrice($price, $osC_Product->getData('tax_class_id')) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($special_price, $osC_Product->getData('tax_class_id')) . '</span>';
         }
         $product = array('id' => $products_id_string, 'link' => osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()), 'name' => substr($data['name'], 0, self::PRODUCTS_NAME_LENGTH) . (strlen($data['name']) > self::PRODUCTS_NAME_LENGTH ? '..' : ''), 'title' => $data['name'], 'quantity' => $data['quantity'] . ' x ', 'price' => $price);
         //variantsol
         if (is_array($data['variants']) && !empty($data['variants'])) {
             $product['variants'] = array_values($data['variants']);
         }
         //customizations
         if (is_array($data['customizations']) && !empty($data['customizations'])) {
             $product['customizations'] = array_values($data['customizations']);
         }
         //gift certificate
         if ($data['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
             $gc_data = $osC_Language->get('senders_name') . ': ' . $data['gc_data']['senders_name'];
             if ($data['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $gc_data .= '<br />- ' . $osC_Language->get('senders_email') . ': ' . $data['gc_data']['senders_email'];
             }
             $gc_data .= '<br />- ' . $osC_Language->get('recipients_name') . ': ' . $data['gc_data']['recipients_name'];
             if ($data['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $gc_data .= '<br />- ' . $osC_Language->get('recipients_email') . ': ' . $data['gc_data']['recipients_email'];
             }
             $gc_data .= '<br />- ' . $osC_Language->get('message') . ': ' . $data['gc_data']['message'];
             $product['gc_data'] = $gc_data;
         }
         $products[] = $product;
     }
     $cart['products'] = $products;
     //order totals
     $order_totals = array();
     foreach ($osC_ShoppingCart->getOrderTotals() as $module) {
         $order_totals[] = array('title' => $module['title'], 'text' => $module['text']);
     }
     $cart['orderTotals'] = $order_totals;
     //numberOfItems
     $cart['numberOfItems'] = $osC_ShoppingCart->numberOfItems();
     //cart total
     $cart['total'] = $osC_Currencies->format($osC_ShoppingCart->getTotal());
     return $cart;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:69,代码来源:ajax_shopping_cart.php


注:本文中的osC_Product::isGiftCertificate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。