本文整理汇总了PHP中Product::getAllCustomizedDatas方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getAllCustomizedDatas方法的具体用法?PHP Product::getAllCustomizedDatas怎么用?PHP Product::getAllCustomizedDatas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::getAllCustomizedDatas方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Return Merchandise Authorization (RMA)'), 'image' => '../img/admin/return.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_order'), array('type' => 'hidden', 'name' => 'id_customer'), array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => '', 'size' => '', 'required' => false), array('type' => 'text_order', 'label' => $this->l('Order'), 'name' => '', 'size' => '', 'required' => false), array('type' => 'free', 'label' => $this->l('Customer explanation'), 'name' => 'question', 'size' => '', 'required' => false), array('type' => 'select', 'label' => $this->l('Status'), 'name' => 'state', 'required' => false, 'options' => array('query' => OrderReturnState::getOrderReturnStates($this->context->language->id), 'id' => 'id_order_return_state', 'name' => 'name'), 'desc' => $this->l('Merchandise return (RMA) status.')), array('type' => 'list_products', 'label' => $this->l('Products'), 'name' => '', 'size' => '', 'required' => false, 'desc' => $this->l('List of products in return package.')), array('type' => 'pdf_order_return', 'label' => $this->l('Return slip'), 'name' => '', 'size' => '', 'required' => false, 'desc' => $this->l('The link is only available after validation and before the parcel gets delivered.'))), 'submit' => array('title' => $this->l('Save')));
$order = new Order($this->object->id_order);
$quantity_displayed = array();
// Customized products */
if ($returned_customizations = OrderReturn::getReturnedCustomizedProducts((int) $this->object->id_order)) {
foreach ($returned_customizations as $returned_customization) {
$quantity_displayed[(int) $returned_customization['id_order_detail']] = isset($quantity_displayed[(int) $returned_customization['id_order_detail']]) ? $quantity_displayed[(int) $returned_customization['id_order_detail']] + (int) $returned_customization['product_quantity'] : (int) $returned_customization['product_quantity'];
}
}
// Classic products
$products = OrderReturn::getOrdersReturnProducts($this->object->id, $order);
// Prepare customer explanation for display
$this->object->question = '<span class="normal-text">' . nl2br($this->object->question) . '</span>';
$this->tpl_form_vars = array('customer' => new Customer($this->object->id_customer), 'url_customer' => 'index.php?tab=AdminCustomers&id_customer=' . (int) $this->object->id_customer . '&viewcustomer&token=' . Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id), 'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd)), 'url_order' => 'index.php?tab=AdminOrders&id_order=' . (int) $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $this->context->employee->id), 'picture_folder' => _THEME_PROD_PIC_DIR_, 'returnedCustomizations' => $returned_customizations, 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart), 'products' => $products, 'quantityDisplayed' => $quantity_displayed, 'id_order_return' => $this->object->id, 'state_order_return' => $this->object->state);
return parent::renderForm();
}
示例2: run
public function run()
{
$this->init();
$this->preProcess();
if (Tools::getValue('ajax') == 'true') {
if (Tools::getIsset('summary')) {
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
if (self::$cookie->id_customer) {
$customer = new Customer((int) self::$cookie->id_customer);
$groups = $customer->getGroups();
} else {
$groups = array(1);
}
if ((int) self::$cart->id_address_delivery) {
$deliveryAddress = new Address((int) self::$cart->id_address_delivery);
}
$result = array('carriers' => Carrier::getCarriersForOrder((int) Country::getIdZone((isset($deliveryAddress) and (int) $deliveryAddress->id) ? (int) $deliveryAddress->id_country : (int) Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
}
$result['summary'] = self::$cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas((int) self::$cart->id);
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
die(Tools::jsonEncode($result));
} else {
$this->includeCartModule();
}
} else {
$this->setMedia();
$this->displayHeader();
$this->process();
$this->displayContent();
$this->displayFooter();
}
}
示例3: displayOrderStep
function displayOrderStep($params)
{
global $smarty, $cart, $errors;
$smarty->assign('errors', $errors);
if (file_exists(_PS_SHIP_IMG_DIR_ . intval($cart->id_carrier) . '.jpg')) {
$smarty->assign('carrierPicture', 1);
}
$cart->save();
// Hack to get loyalty and other modules happy
$summary = $cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas(intval($cart->id));
Product::addCustomizationPrice($summary['products'], $customizedDatas);
if ($free_ship = intval(Configuration::get('PS_SHIPPING_FREE_PRICE'))) {
$discounts = $cart->getDiscounts();
$total_free_ship = $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
foreach ($discounts as $discount) {
if ($discount['id_discount_type'] == 3) {
$total_free_ship = 0;
break;
}
}
$smarty->assign('free_ship', $total_free_ship);
}
$smarty->assign($summary);
$token = Tools::getToken(false);
$smarty->assign(array('token_cart' => $token, 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary), 'shippingCost' => $cart->getOrderTotalLC(true, 5), 'shippingCostTaxExc' => $cart->getOrderTotalLC(false, 5), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $cart->getLastProduct()));
Tools::safePostVars();
include_once dirname(__FILE__) . '/../../header.php';
echo $this->display(__FILE__, 'ordersummary.tpl');
}
示例4: smartyAssigns
public function smartyAssigns(&$smarty, &$params)
{
global $errors, $cookie;
// Set currency
if (!intval($params['cart']->id_currency)) {
$currency = new Currency(intval($params['cookie']->id_currency));
} else {
$currency = new Currency(intval($params['cart']->id_currency));
}
if (!Validate::isLoadedObject($currency)) {
$currency = new Currency(intval(Configuration::get('PS_CURRENCY_DEFAULT')));
}
if ($params['cart']->id_customer) {
$customer = new Customer(intval($params['cart']->id_customer));
$taxCalculationMethod = Group::getPriceDisplayMethod(intval($customer->id_default_group));
} else {
$taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
}
$usetax = $taxCalculationMethod == PS_TAX_EXC ? false : true;
$products = $params['cart']->getProducts(true);
$nbTotalProducts = 0;
foreach ($products as $product) {
$nbTotalProducts += intval($product['cart_quantity']);
}
$wrappingCost = floatval($params['cart']->getOrderTotal($usetax, 6));
$smarty->assign(array('products' => $products, 'customizedDatas' => Product::getAllCustomizedDatas(intval($params['cart']->id)), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'discounts' => $params['cart']->getDiscounts(false, $usetax), 'nb_total_products' => intval($nbTotalProducts), 'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal($usetax, 5), $currency), 'show_wrapping' => $wrappingCost > 0 ? true : false, 'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($usetax, 4), $currency), 'total' => Tools::displayPrice($params['cart']->getOrderTotal($usetax), $currency), 'id_carrier' => intval($params['cart']->id_carrier), 'ajax_allowed' => intval(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false));
if (sizeof($errors)) {
$smarty->assign('errors', $errors);
}
if (isset($cookie->ajax_blockcart_display)) {
$smarty->assign('colapseExpandStatus', $cookie->ajax_blockcart_display);
}
}
示例5: renderView
public function renderView()
{
if (!($cart = $this->loadObject(true))) {
return;
}
$customer = new Customer($cart->id_customer);
$this->context->cart = $cart;
$this->context->customer = $customer;
$products = $cart->getProducts();
$customized_datas = Product::getAllCustomizedDatas((int) $cart->id);
Product::addCustomizationPrice($products, $customized_datas);
$summary = $cart->getSummaryDetails();
$currency = new Currency($cart->id_currency);
/* Display order information */
$id_order = (int) Order::getOrderByCartId($cart->id);
$order = new Order($id_order);
if ($order->getTaxCalculationMethod() == PS_TAX_EXC) {
$total_products = $summary['total_products'];
$total_discounts = $summary['total_discounts_tax_exc'];
$total_wrapping = $summary['total_wrapping_tax_exc'];
$total_price = $summary['total_price_without_tax'];
$total_shipping = $summary['total_shipping_tax_exc'];
} else {
$total_products = $summary['total_products_wt'];
$total_discounts = $summary['total_discounts'];
$total_wrapping = $summary['total_wrapping'];
$total_price = $summary['total_price'];
$total_shipping = $summary['total_shipping'];
}
foreach ($products as $k => &$product) {
if ($order->getTaxCalculationMethod() == PS_TAX_EXC) {
$product['product_price'] = $product['price'];
$product['product_total'] = $product['total'];
} else {
$product['product_price'] = $product['price_wt'];
$product['product_total'] = $product['total_wt'];
}
$image = array();
if (isset($product['id_product_attribute']) && (int) $product['id_product_attribute']) {
$image = Db::getInstance()->getRow('SELECT id_image
FROM ' . _DB_PREFIX_ . 'product_attribute_image
WHERE id_product_attribute = ' . (int) $product['id_product_attribute']);
}
if (!isset($image['id_image'])) {
$image = Db::getInstance()->getRow('SELECT id_image
FROM ' . _DB_PREFIX_ . 'image
WHERE id_product = ' . (int) $product['id_product'] . ' AND cover = 1');
}
$product_obj = new Product($product['id_product']);
$product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int) $order->id_shop);
$image_product = new Image($image['id_image']);
$product['image'] = isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $image_product->getExistingImgPath() . '.jpg', 'product_mini_' . (int) $product['id_product'] . (isset($product['id_product_attribute']) ? '_' . (int) $product['id_product_attribute'] : '') . '.jpg', 45, 'jpg') : '--';
}
$this->tpl_view_vars = array('products' => $products, 'discounts' => $cart->getCartRules(), 'order' => $order, 'cart' => $cart, 'currency' => $currency, 'customer' => $customer, 'customer_stats' => $customer->getStats(), 'total_products' => $total_products, 'total_discounts' => $total_discounts, 'total_wrapping' => $total_wrapping, 'total_price' => $total_price, 'total_shipping' => $total_shipping, 'customized_datas' => $customized_datas);
return parent::renderView();
}
示例6: _assignSummaryInformations
protected function _assignSummaryInformations()
{
$summary = $this->context->cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
// override customization tax rate with real tax (tax rules)
if ($customizedDatas) {
foreach ($summary['products'] as &$productUpdate) {
$productId = (int) isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id'];
$productAttributeId = (int) isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id'];
if (isset($customizedDatas[$productId][$productAttributeId])) {
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
}
}
Product::addCustomizationPrice($summary['products'], $customizedDatas);
}
$cart_product_context = Context::getContext()->cloneContext();
foreach ($summary['products'] as $key => &$product) {
$product['quantity'] = $product['cart_quantity'];
// for compatibility with 1.2 themes
if ($cart_product_context->shop->id != $product['id_shop']) {
$cart_product_context->shop = new Shop((int) $product['id_shop']);
}
$product['price_without_specific_price'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], _PS_PRICE_COMPUTE_PRECISION_, null, false, false, 1, false, null, null, null, $null, true, true, $cart_product_context);
/**
* ABU edit: variable is_discount set à 1 à tord, calcul foireux de presta
* @bugfix: https://github.com/PrestaShop/PrestaShop/commit/379e28b341730ea95c0b2d6567817305ea841b23
* @perso: soustraction de l'ecotax au price_without_specific_price @else
*/
if (Product::getTaxCalculationMethod()) {
// $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
$product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price'], _PS_PRICE_COMPUTE_PRECISION_);
} else {
// $product['is_discounted'] = $product['price_without_specific_price'] != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
$product['is_discounted'] = Tools::ps_round($product['price_without_specific_price'] - $product['ecotax'], _PS_PRICE_COMPUTE_PRECISION_) != Tools::ps_round($product['price_wt'], _PS_PRICE_COMPUTE_PRECISION_);
}
}
// Get available cart rules and unset the cart rules already in the cart
$available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, isset($this->context->customer->id) ? $this->context->customer->id : 0, true, true, true, $this->context->cart);
$cart_cart_rules = $this->context->cart->getCartRules();
foreach ($available_cart_rules as $key => $available_cart_rule) {
if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], CartRule::BO_ORDER_CODE_PREFIX) === 0) {
unset($available_cart_rules[$key]);
continue;
}
foreach ($cart_cart_rules as $cart_cart_rule) {
if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule']) {
unset($available_cart_rules[$key]);
continue 2;
}
}
}
$show_option_allow_separate_package = !$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE');
$this->context->smarty->assign($summary);
$this->context->smarty->assign(array('token_cart' => Tools::getToken(false), 'isLogged' => $this->isLogged, 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => $available_cart_rules, 'show_option_allow_separate_package' => $show_option_allow_separate_package, 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))));
$this->context->smarty->assign(array('HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary)));
}
示例7: process
public function process()
{
parent::process();
if ($id_order = Tools::getValue('id_order') and $email = Tools::getValue('email')) {
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order)) {
$this->errors[] = Tools::displayError('Invalid order');
} elseif (!$order->isAssociatedAtGuest($email)) {
$this->errors[] = Tools::displayError('Invalid order');
} else {
$customer = new Customer((int) $order->id_customer);
$id_order_state = (int) $order->getCurrentState();
$carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
$addressInvoice = new Address((int) $order->id_address_invoice);
$addressDelivery = new Address((int) $order->id_address_delivery);
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
$invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
$deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
if ($order->total_discounts > 0) {
self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
}
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$this->processAddressFormat($addressDelivery, $addressInvoice);
self::$smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order' => $order, 'return_allowed' => false, 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'customizedDatas' => $customizedDatas, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues));
if ($carrier->url and $order->shipping_number) {
self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
}
self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
if (Tools::isSubmit('submitTransformGuestToCustomer')) {
$customer = new Customer((int) $order->id_customer);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('Invalid customer');
}
if (!$customer->transformToCustomer(self::$cookie->id_lang, Tools::getValue('password'))) {
$this->errors[] = Tools::displayError('An error occurred while transforming guest to customer.');
}
if (!Tools::getValue('password')) {
$this->errors[] = Tools::displayError('Invalid password');
} else {
self::$smarty->assign('transformSuccess', true);
}
}
}
if (sizeof($this->errors)) {
/* Handle brute force attacks */
sleep(1);
}
}
self::$smarty->assign(array('action' => 'guest-tracking.php', 'errors' => $this->errors));
}
示例8: __construct
public function __construct(OrderSlip $order_slip, $smarty)
{
$this->order_slip = $order_slip;
$this->order = new Order((int) $order_slip->id_order);
$products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
$customized_datas = Product::getAllCustomizedDatas((int) $this->order->id_cart);
Product::addCustomizationPrice($products, $customized_datas);
$this->order->products = $products;
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order_slip->date_add);
$this->title = HTMLTemplateOrderSlip::l('Order slip #') . Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id) . sprintf('%06d', (int) $this->order_slip->id);
// footer informations
$this->shop = new Shop((int) $this->order->id_shop);
}
示例9: __construct
public function __construct(OrderSlip $order_slip, $smarty)
{
$this->order_slip = $order_slip;
$this->order = new Order((int) $order_slip->id_order);
$products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
$customized_datas = Product::getAllCustomizedDatas((int) $this->order->id_cart);
Product::addCustomizationPrice($products, $customized_datas);
$this->order->products = $products;
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order->invoice_date, (int) $this->order->id_lang);
$this->title = HTMLTemplateOrderSlip::l('Slip #') . sprintf('%06d', (int) $this->order_slip->id);
// footer informations
$this->shop = new Shop((int) $this->order->id_shop);
}
示例10: __construct
/**
* @param OrderSlip $order_slip
* @param $smarty
* @throws PrestaShopException
*/
public function __construct(OrderSlip $order_slip, $smarty)
{
$this->order_slip = $order_slip;
$this->order = new Order((int) $order_slip->id_order);
$this->id_cart = $this->order->id_cart;
$products = OrderSlip::getOrdersSlipProducts($this->order_slip->id, $this->order);
foreach ($products as $product) {
$customized_datas = Product::getAllCustomizedDatas($this->id_cart, null, true, null, (int) $product['id_customization']);
Product::addProductCustomizationPrice($product, $customized_datas);
}
$this->order->products = $products;
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order_slip->date_add);
$prefix = Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id);
$this->title = sprintf(HTMLTemplateOrderSlip::l('%1$s%2$06d'), $prefix, (int) $this->order_slip->id);
$this->shop = new Shop((int) $this->order->id_shop);
}
示例11: preProcess
public function preProcess()
{
parent::preProcess();
if (!isset($_GET['id_order_return']) or !Validate::isUnsignedId($_GET['id_order_return'])) {
$this->errors[] = Tools::displayError('Order ID required');
} else {
$orderRet = new OrderReturn((int) $_GET['id_order_return']);
if (Validate::isLoadedObject($orderRet) and $orderRet->id_customer == self::$cookie->id_customer) {
$order = new Order((int) $orderRet->id_order);
if (Validate::isLoadedObject($order)) {
$state = new OrderReturnState((int) $orderRet->state);
self::$smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[(int) self::$cookie->id_lang], 'return_allowed' => false, 'products' => OrderReturn::getOrdersReturnProducts((int) $orderRet->id, $order), 'returnedCustomizations' => OrderReturn::getReturnedCustomizedProducts((int) $orderRet->id_order), 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart)));
} else {
$this->errors[] = Tools::displayError('Cannot find this order return');
}
} else {
$this->errors[] = Tools::displayError('Cannot find this order return');
}
}
self::$smarty->assign(array('errors' => $this->errors, 'nbdaysreturn' => (int) Configuration::get('PS_ORDER_RETURN_NB_DAYS')));
}
示例12: smartyAssigns
public function smartyAssigns(&$smarty, &$params)
{
global $errors, $cookie;
// Set currency
if (!(int) $params['cart']->id_currency) {
$currency = new Currency((int) $params['cookie']->id_currency);
} else {
$currency = new Currency((int) $params['cart']->id_currency);
}
if (!Validate::isLoadedObject($currency)) {
$currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
}
if ($params['cart']->id_customer) {
$customer = new Customer((int) $params['cart']->id_customer);
$taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group);
} else {
$taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
}
$useTax = $taxCalculationMethod != PS_TAX_EXC;
$products = $params['cart']->getProducts(true);
$nbTotalProducts = 0;
foreach ($products as $product) {
$nbTotalProducts += (int) $product['cart_quantity'];
}
$wrappingCost = (double) $params['cart']->getOrderTotal($useTax, Cart::ONLY_WRAPPING);
if (Configuration::get('PS_TAX_DISPLAY') == 1 && ($useTax || Configuration::get('PS_TAX_DISPLAY_ALL'))) {
$totalToPay = $params['cart']->getOrderTotal(true);
$totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false);
$smarty->assign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency));
} else {
$totalToPay = $params['cart']->getOrderTotal($useTax);
}
$smarty->assign(array('products' => $products, 'customizedDatas' => Product::getAllCustomizedDatas((int) $params['cart']->id), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'discounts' => $params['cart']->getDiscounts(false, Tools::isSubmit('id_product')), 'nb_total_products' => (int) $nbTotalProducts, 'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_SHIPPING), $currency), 'show_wrapping' => $wrappingCost > 0 ? true : false, 'show_tax' => (int) ((int) Configuration::get('PS_TAX_DISPLAY') && (int) Configuration::get('PS_TAX')), 'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::BOTH_WITHOUT_SHIPPING), $currency), 'total' => Tools::displayPrice($totalToPay, $currency), 'id_carrier' => (int) $params['cart']->id_carrier, 'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order', 'ajax_allowed' => (int) Configuration::get('PS_BLOCK_CART_AJAX') == 1 ? true : false));
if (sizeof($errors)) {
$smarty->assign('errors', $errors);
}
if (isset($cookie->ajax_blockcart_display)) {
$smarty->assign('colapseExpandStatus', $cookie->ajax_blockcart_display);
}
}
示例13: init
/**
* Initialize order return controller
* @see FrontController::init()
*/
public function init()
{
parent::init();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
if (!isset($_GET['id_order_return']) || !Validate::isUnsignedId($_GET['id_order_return'])) {
$this->errors[] = Tools::displayError('Order ID required');
} else {
$orderRet = new OrderReturn((int) $_GET['id_order_return']);
if (Validate::isLoadedObject($orderRet) && $orderRet->id_customer == $this->context->cookie->id_customer) {
$order = new Order((int) $orderRet->id_order);
if (Validate::isLoadedObject($order)) {
$state = new OrderReturnState((int) $orderRet->state);
$this->context->smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[(int) $this->context->language->id], 'return_allowed' => false, 'products' => OrderReturn::getOrdersReturnProducts((int) $orderRet->id, $order), 'returnedCustomizations' => OrderReturn::getReturnedCustomizedProducts((int) $orderRet->id_order), 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart)));
} else {
$this->errors[] = Tools::displayError('Cannot find the order return.');
}
} else {
$this->errors[] = Tools::displayError('Cannot find the order return.');
}
}
}
示例14: smartyAssigns
function smartyAssigns(&$smarty, &$params)
{
global $errors;
// Set currency
if (!intval($params['cart']->id_currency)) {
$currency = new Currency(intval($params['cookie']->id_currency));
} else {
$currency = new Currency(intval($params['cart']->id_currency));
}
if (!Validate::isLoadedObject($currency)) {
$currency = new Currency(intval(Configuration::get('PS_DEFAULT_CURRENCY')));
}
$products = $params['cart']->getProducts(true);
foreach ($products as $k => $product) {
$products[$k]['real_price'] = Product::getPriceStatic($product['id_product'], intval(Configuration::get('PS_PRICE_DISPLAY')) == 1 ? false : true, $product['id_product_attribute'], 6, NULL, false, true, $product['cart_quantity']) * $product['cart_quantity'];
}
$smarty->assign(array('products' => $products, 'customizedDatas' => Product::getAllCustomizedDatas(intval($params['cart']->id)), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'discounts' => $params['cart']->getDiscounts(false, true), 'nb_total_products' => $params['cart']->nbProducts(), 'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal(intval(Configuration::get('PS_PRICE_DISPLAY')) == 1 ? false : true, 5), $currency), 'show_wrapping' => floatval($params['cart']->getOrderTotal(true, 6)) > 0 ? true : false, 'wrapping_cost' => Tools::displayPrice($params['cart']->getOrderTotal(intval(Configuration::get('PS_PRICE_DISPLAY')) == 1 ? false : true, 6), $currency), 'product_total' => Tools::displayPrice($params['cart']->getOrderTotal(intval(Configuration::get('PS_PRICE_DISPLAY')) == 1 ? false : true, 4), $currency), 'total' => Tools::displayPrice($params['cart']->getOrderTotal(intval(Configuration::get('PS_PRICE_DISPLAY')) == 1 ? false : true), $currency), 'id_carrier' => $params['cart']->id_carrier, 'ajax_allowed' => intval(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false));
if (sizeof($errors)) {
$smarty->assign('errors', $errors);
}
if (isset($params['cookie']->ajax_blockcart_display)) {
$smarty->assign('colapseExpandStatus', $params['cookie']->ajax_blockcart_display);
}
}
示例15: getCartSummary
protected function getCartSummary()
{
$summary = $this->context->cart->getSummaryDetails(null, true);
$currency = Context::getContext()->currency;
if (count($summary['products'])) {
foreach ($summary['products'] as &$product) {
$product['numeric_price'] = $product['price'];
$product['numeric_total'] = $product['total'];
$product['price'] = str_replace($currency->sign, '', Tools::displayPrice($product['price'], $currency));
$product['total'] = str_replace($currency->sign, '', Tools::displayPrice($product['total'], $currency));
$product['image_link'] = $this->context->link->getImageLink($product['link_rewrite'], $product['id_image'], 'small_default');
if (!isset($product['attributes_small'])) {
$product['attributes_small'] = '';
}
$product['customized_datas'] = Product::getAllCustomizedDatas((int) $this->context->cart->id, null, true);
}
}
if (count($summary['discounts'])) {
foreach ($summary['discounts'] as &$voucher) {
$voucher['value_real'] = Tools::displayPrice($voucher['value_real'], $currency);
}
}
if (isset($summary['gift_products']) && count($summary['gift_products'])) {
foreach ($summary['gift_products'] as &$product) {
$product['image_link'] = $this->context->link->getImageLink($product['link_rewrite'], $product['id_image'], 'small_default');
if (!isset($product['attributes_small'])) {
$product['attributes_small'] = '';
}
}
}
return $summary;
}