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); } }
public function assignContentVars(&$params) { global $errors; // Set currency if ((int) $params['cart']->id_currency && (int) $params['cart']->id_currency != $this->context->currency->id) { $currency = new Currency((int) $params['cart']->id_currency); } else { $currency = $this->context->currency; } 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']; } $cart_rules = $params['cart']->getCartRules(); $shipping_cost = Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_SHIPPING), $currency); $shipping_cost_float = Tools::convertPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_SHIPPING), $currency); $wrappingCost = (double) $params['cart']->getOrderTotal($useTax, Cart::ONLY_WRAPPING); $totalToPay = $params['cart']->getOrderTotal($useTax); if ($useTax && Configuration::get('PS_TAX_DISPLAY') == 1) { $totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false); $this->smarty->assign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency)); } // The cart content is altered for display foreach ($cart_rules as &$cart_rule) { if ($cart_rule['free_shipping']) { $shipping_cost = Tools::displayPrice(0, $currency); $shipping_cost_float = 0; $cart_rule['value_real'] -= Tools::convertPrice($params['cart']->getOrderTotal(true, Cart::ONLY_SHIPPING), $currency); $cart_rule['value_tax_exc'] = Tools::convertPrice($params['cart']->getOrderTotal(false, Cart::ONLY_SHIPPING), $currency); } if ($cart_rule['gift_product']) { foreach ($products as &$product) { if ($product['id_product'] == $cart_rule['gift_product'] && $product['id_product_attribute'] == $cart_rule['gift_product_attribute']) { $product['total_wt'] = Tools::ps_round($product['total_wt'] - $product['price_wt'], (int) $currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); $product['total'] = Tools::ps_round($product['total'] - $product['price'], (int) $currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); $cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'] - $product['price_wt'], (int) $currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); $cart_rule['value_tax_exc'] = Tools::ps_round($cart_rule['value_tax_exc'] - $product['price'], (int) $currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); } } } } $this->smarty->assign(array('products' => $products, 'customizedDatas' => Product::getAllCustomizedDatas((int) $params['cart']->id), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'discounts' => $cart_rules, 'nb_total_products' => (int) $nbTotalProducts, 'shipping_cost' => $shipping_cost, 'shipping_cost_float' => $shipping_cost_float, 'show_wrapping' => $wrappingCost > 0 ? true : false, 'show_tax' => (int) (Configuration::get('PS_TAX_DISPLAY') == 1 && (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), 'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order', 'ajax_allowed' => (int) Configuration::get('PS_BLOCK_CART_AJAX') == 1 ? true : false, 'static_token' => Tools::getToken(false))); if (count($errors)) { $this->smarty->assign('errors', $errors); } if (isset($this->context->cookie->ajax_blockcart_display)) { $this->smarty->assign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display); } }
public function __construct($id = NULL, $id_lang = NULL) { parent::__construct($id, $id_lang); if ($this->id_customer) { $customer = new Customer(intval($this->id_customer)); $this->_taxCalculationMethod = Group::getPriceDisplayMethod(intval($customer->id_default_group)); } else { $this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); } }
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); } }
$smarty->register_function('convertPriceWithoutDisplay', array('Product', 'productPriceWithoutDisplay')); $smarty->register_function('convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency')); $smarty->register_function('displayWtPrice', array('Product', 'displayWtPrice')); $smarty->register_function('displayWtPriceWithCurrency', array('Product', 'displayWtPriceWithCurrency')); $smarty->register_function('displayPrice', array('Tools', 'displayPriceSmarty')); $smarty->assign(Tools::getMetaTags(intval($cookie->id_lang))); $smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI']))); /* Breadcrumb */ $navigationPipe = Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>'; $smarty->assign('navigationPipe', $navigationPipe); /* Server Params */ $server_host = Tools::getHttpHost(false, true); $protocol = 'http://'; $protocol_ssl = 'https://'; $protocol_link = Configuration::get('PS_SSL_ENABLED') ? $protocol_ssl : $protocol; $protocol_content = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED')) ? $protocol_ssl : $protocol; define('_PS_BASE_URL_', $protocol . $server_host); Product::initPricesComputation(); if (!Configuration::get('PS_THEME_V11')) { define('_PS_BASE_URL_SSL_', $protocol_ssl . $server_host); $smarty->assign(array('base_dir' => _PS_BASE_URL_ . __PS_BASE_URI__, 'base_dir_ssl' => $protocol_link . $server_host . __PS_BASE_URI__, 'content_dir' => $protocol_content . $server_host . __PS_BASE_URI__, 'img_ps_dir' => $protocol_content . $server_host . _PS_IMG_, 'img_cat_dir' => $protocol_content . $server_host . _THEME_CAT_DIR_, 'img_lang_dir' => $protocol_content . $server_host . _THEME_LANG_DIR_, 'img_prod_dir' => $protocol_content . $server_host . _THEME_PROD_DIR_, 'img_manu_dir' => $protocol_content . $server_host . _THEME_MANU_DIR_, 'img_sup_dir' => $protocol_content . $server_host . _THEME_SUP_DIR_, 'img_ship_dir' => $protocol_content . $server_host . _THEME_SHIP_DIR_, 'img_col_dir' => $protocol_content . $server_host . _THEME_COL_DIR_, 'img_dir' => $protocol_content . $server_host . _THEME_IMG_DIR_, 'css_dir' => $protocol_content . $server_host . _THEME_CSS_DIR_, 'js_dir' => $protocol_content . $server_host . _THEME_JS_DIR_, 'tpl_dir' => _PS_THEME_DIR_, 'modules_dir' => _MODULE_DIR_, 'mail_dir' => _MAIL_DIR_, 'pic_dir' => $protocol_content . $server_host . _THEME_PROD_PIC_DIR_, 'lang_iso' => $ps_language->iso_code, 'come_from' => Tools::getHttpHost(true, true) . htmlentities($_SERVER['REQUEST_URI']), 'shop_name' => Configuration::get('PS_SHOP_NAME'), 'cart_qties' => intval($cart->nbProducts()), 'cart' => $cart, 'currencies' => Currency::getCurrencies(), 'id_currency_cookie' => intval($currency->id), 'currency' => $currency, 'cookie' => $cookie, 'languages' => Language::getLanguages(), 'logged' => $cookie->isLogged(), 'page_name' => $page_name, 'customerName' => $cookie->logged ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : false, 'priceDisplay' => intval($cookie->id_customer ? Group::getPriceDisplayMethod(intval($cookie->id_customer)) : Group::getDefaultPriceDisplayMethod()), 'roundMode' => intval(Configuration::get('PS_PRICE_ROUND_MODE')))); } else { $protocol = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; $smarty->assign(array('base_dir' => __PS_BASE_URI__, 'base_dir_ssl' => Tools::getHttpHost(true, true) . __PS_BASE_URI__, 'content_dir' => __PS_BASE_URI__, 'protocol' => $protocol, 'img_ps_dir' => _PS_IMG_, 'img_cat_dir' => _THEME_CAT_DIR_, 'img_lang_dir' => _THEME_LANG_DIR_, 'img_prod_dir' => _THEME_PROD_DIR_, 'img_manu_dir' => _THEME_MANU_DIR_, 'img_sup_dir' => _THEME_SUP_DIR_, 'img_ship_dir' => _THEME_SHIP_DIR_, 'img_col_dir' => _THEME_COL_DIR_, 'img_dir' => _THEME_IMG_DIR_, 'css_dir' => _THEME_CSS_DIR_, 'js_dir' => _THEME_JS_DIR_, 'tpl_dir' => _PS_THEME_DIR_, 'modules_dir' => _MODULE_DIR_, 'mail_dir' => _MAIL_DIR_, 'pic_dir' => _THEME_PROD_PIC_DIR_, 'lang_iso' => $ps_language->iso_code, 'come_from' => Tools::getHttpHost(true, true) . htmlentities($_SERVER['REQUEST_URI']), 'shop_name' => Configuration::get('PS_SHOP_NAME'), 'cart_qties' => intval($cart->nbProducts()), 'cart' => $cart, 'currencies' => Currency::getCurrencies(), 'id_currency_cookie' => intval($currency->id), 'currency' => $currency, 'cookie' => $cookie, 'languages' => Language::getLanguages(), 'logged' => $cookie->isLogged(), 'priceDisplay' => intval($cookie->id_customer ? Group::getPriceDisplayMethod(intval($cookie->id_customer)) : Group::getDefaultPriceDisplayMethod()), 'page_name' => $page_name, 'customerName' => $cookie->logged ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : false, 'roundMode' => intval(Configuration::get('PS_PRICE_ROUND_MODE')))); } /* Display a maintenance page if shop is closed */ if (isset($maintenance) and (!isset($_SERVER['REMOTE_ADDR']) or !in_array($_SERVER['REMOTE_ADDR'], explode(',', Configuration::get('PS_MAINTENANCE_IP'))))) { header('HTTP/1.1 503 temporarily overloaded'); $smarty->display(_PS_THEME_DIR_ . 'maintenance.tpl'); exit; }
public function __construct($id = null, $id_lang = null) { parent::__construct($id, $id_lang); $is_admin = is_object(Context::getContext()->controller) && Context::getContext()->controller->controller_type == 'admin'; if ($this->id_customer && !$is_admin) { $customer = new Customer((int) $this->id_customer); $this->_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group); } else { $this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); } }
public function __construct($id = NULL, $id_lang = NULL) { parent::__construct($id, $id_lang); if ($this->id_customer) { $customer = new Customer((int) $this->id_customer); $this->_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group); if ((!$this->secure_key or $this->secure_key == '-1') and $customer->secure_key) { $this->secure_key = $customer->secure_key; $this->save(); } } else { $this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); } }
public static function initPricesComputation($id_customer = NULL) { global $cookie; if ($id_customer) { $customer = new Customer((int) $id_customer); if (!Validate::isLoadedObject($customer)) { die(Tools::displayError()); } self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group); } elseif ($cookie->id_customer) { $customer = new Customer((int) $cookie->id_customer); self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group); } else { self::$_taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); } }
public static function initPricesComputation($id_customer = null) { if ($id_customer) { $customer = new Customer((int) $id_customer); if (!Validate::isLoadedObject($customer)) { die(Tools::displayError()); } self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group); } else { if (Validate::isLoadedObject(Context::getContext()->customer)) { self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Context::getContext()->customer->id_default_group); } else { self::$_taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); } } }
$product_attribute = (int) $params['attribute']; // Product combination id $quantity = (int) $params['quantity']; // Quantity $minimum_surface_quantity = Configuration::get('AIMD_MIN_SURFACE_ON_QUANTITY'); // Quantity is taken to compare to minimum surface to charge $minimum_surface = (double) DB::getInstance()->getValue('SELECT aimd_msc FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . $product_id); // Minimum surface to charge $global_reduction = Configuration::get('AIMD_GLOBAL_REDUCTION'); // Global reduction // Get customer group taxes rules & global taxes rules $group_id = 1; if (isset($cookie->id_customer)) { $group_id = Customer::getDefaultGroupId($cookie->id_customer); } if (intval(Group::getDefaultPriceDisplayMethod($group_id)) == 1 || !Configuration::get('PS_TAX')) { $taxes = 1; // Taxes rate $base_price = Product::getPriceStatic($product_id, false, false, 6, NULL, false, false); // Product price without taxes & without attributes } else { $taxes = 1 + Tax::getProductTaxRate($product_id) / 100; // Taxes rate $base_price = Product::getPriceStatic($product_id, true, false, 6, NULL, false, false); // Product price with taxes & without attributes } // Get the multi-dimensionnal parameters $dimensions = array(); $scales = array(); if (Configuration::get('AIMD_FIRST_DIMENSION_ACTIVE') == 1) { $dimensions[] = Configuration::get('AIMD_FIRST_DIMENSION_ID');
public function __construct($id = NULL, $id_lang = NULL) { parent::__construct($id, $id_lang); $this->_taxCalculationMethod = $this->id_customer ? Group::getPriceDisplayMethod(intval($this->id_customer)) : Group::getDefaultPriceDisplayMethod(); }
public function __construct($id = null, $id_lang = null) { parent::__construct($id, $id_lang); if ($this->id_customer) { if (isset(Context::getContext()->customer) && Context::getContext()->customer->id == $this->id_customer) { $customer = Context::getContext()->customer; } else { $customer = new Customer((int) $this->id_customer); } $this->_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group); if ((!$this->secure_key || $this->secure_key == '-1') && $customer->secure_key) { $this->secure_key = $customer->secure_key; $this->save(); } } else { $this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod(); } }
public function getAuthorisation() { global $cookie, $cart; // Getting cart informations $currency = new Currency((int) $cart->id_currency); if (!Validate::isLoadedObject($currency)) { $this->_logs[] = $this->l('Not a valid currency'); } if (sizeof($this->_logs)) { return false; } // Making request $vars = '?fromPayPal=1'; $returnURL = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/paypal/payment/submit.php' . $vars; $cancelURL = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'order.php'; $paymentAmount = (double) $cart->getOrderTotal(); $currencyCodeType = strval($currency->iso_code); $paymentType = Configuration::get('PAYPAL_CAPTURE') == 1 ? 'Authorization' : 'Sale'; $request = '&Amt=' . urlencode($paymentAmount) . '&PAYMENTACTION=' . urlencode($paymentType) . '&ReturnUrl=' . urlencode($returnURL) . '&CANCELURL=' . urlencode($cancelURL) . '&CURRENCYCODE=' . urlencode($currencyCodeType) . '&NOSHIPPING=1'; if (Configuration::get('PAYPAL_PAYMENT_METHOD') == 0) { $request .= '&SOLUTIONTYPE=Sole&LANDINGPAGE=Billing'; } else { $request .= '&SOLUTIONTYPE=Mark&LANDINGPAGE=Login'; } $request .= '&LOCALECODE=' . strtoupper(Language::getIsoById($cart->id_lang)); if (Configuration::get('PAYPAL_HEADER')) { $request .= '&HDRIMG=' . urlencode(Configuration::get('PAYPAL_HEADER')); } // Customer informations $customer = new Customer((int) $cart->id_customer); $request .= '&EMAIL=' . urlencode($customer->email); //customer // address of delivery $id_address = $cart->id_address_delivery; $address = new Address((int) $id_address); $country = new Country((int) $address->id_country); if ($address->id_state) { $state = new State((int) $address->id_state); } $discounts = (double) $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); if ($discounts == 0) { 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(); } $priceField = $taxCalculationMethod == PS_TAX_EXC ? 'price' : 'price_wt'; $products = $cart->getProducts(); $amt = 0; for ($i = 0; $i < sizeof($products); $i++) { $request .= '&L_NAME' . $i . '=' . substr(urlencode($products[$i]['name'] . (isset($products[$i]['attributes']) ? ' - ' . $products[$i]['attributes'] : '') . (isset($products[$i]['instructions']) ? ' - ' . $products[$i]['instructions'] : '')), 0, 127); $request .= '&L_AMT' . $i . '=' . urlencode($this->PayPalRound($products[$i][$priceField])); $request .= '&L_QTY' . $i . '=' . urlencode($products[$i]['cart_quantity']); $amt += $this->PayPalRound($products[$i][$priceField] * $products[$i]['cart_quantity']); } $shipping = $this->PayPalRound($cart->getOrderShippingCost($cart->id_carrier, false)); $request .= '&ITEMAMT=' . urlencode($amt); $request .= '&SHIPPINGAMT=' . urlencode($shipping); $request .= '&TAXAMT=' . urlencode((double) max($this->PayPalRound($paymentAmount - $amt - $shipping), 0)); } else { $products = $cart->getProducts(); $description = 0; for ($i = 0; $i < sizeof($products); $i++) { $description .= ($description == '' ? '' : ', ') . $products[$i]['cart_quantity'] . " x " . $products[$i]['name'] . (isset($products[$i]['attributes']) ? ' - ' . $products[$i]['attributes'] : '') . (isset($products[$i]['instructions']) ? ' - ' . $products[$i]['instructions'] : ''); } $request .= '&ORDERDESCRIPTION=' . urlencode(substr($description, 0, 120)); } $request .= '&SHIPTONAME=' . urlencode($address->firstname . ' ' . $address->lastname); $request .= '&SHIPTOSTREET=' . urlencode($address->address1); $request .= '&SHIPTOSTREET2=' . urlencode($address->address2); $request .= '&SHIPTOCITY=' . urlencode($address->city); $request .= '&SHIPTOSTATE=' . ($address->id_state ? $state->iso_code : $country->iso_code); $request .= '&SHIPTOZIP=' . urlencode($address->postcode); $request .= '&SHIPTOCOUNTRY=' . urlencode($country->iso_code); $request .= '&SHIPTOPHONENUM=' . urlencode($address->phone); $request .= '&ADDROVERRIDE=1'; // Calling PayPal API include _PS_MODULE_DIR_ . 'paypal/api/paypallib.php'; $ppAPI = new PaypalLib(); $result = $ppAPI->makeCall($this->getAPIURL(), $this->getAPIScript(), 'SetExpressCheckout', $request); $this->_logs = array_merge($this->_logs, $ppAPI->getLogs()); return $result; }
public static function initPricesComputation() { global $cookie; self::$_taxCalculationMethod = $cookie->id_customer ? Group::getPriceDisplayMethod(intval($cookie->id_customer)) : Group::getDefaultPriceDisplayMethod(); }