本文整理汇总了PHP中Product::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getLink方法的具体用法?PHP Product::getLink怎么用?PHP Product::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::getLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendCartMails
function sendCartMails()
{
global $link;
$sql = "SELECT c.id_cart, cc.email, cc.`firstname`, cc.id_customer\n\tFROM `ps_cart` c\n\tINNER JOIN ps_customer cc ON cc.`id_customer` = c.`id_customer`\n\tINNER JOIN `ps_cart_product` cp ON cp.`id_cart` = c.id_cart\n\tLEFT JOIN ps_orders o ON o.`id_cart` = c.id_cart\n\tWHERE o.id_cart IS NULL\n\tAND datediff(curdate(), c.`date_upd`) = 3\n\tAND cc.newsletter = 0\n\tGROUP BY cc.`id_customer`";
/*$sql = "SELECT c.id_cart, cc.email, cc.`firstname`, cc.id_customer
FROM `ps_cart` c
INNER JOIN ps_customer cc ON cc.`id_customer` = c.`id_customer`
INNER JOIN `ps_cart_product` cp ON cp.`id_cart` = c.id_cart
LEFT JOIN ps_orders o ON o.`id_cart` = c.id_cart
WHERE cc.id_customer = 1
GROUP BY cc.`id_customer`";*/
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
$count = 0;
foreach ($res as $row) {
$count++;
$id_cart = Cart::lastNoneOrderedCart($row['id_customer']);
$cart = new Cart($id_cart);
$id_product = $cart->getLastProduct();
$id_product = $id_product['id_product'];
$product = new Product($id_product, true, 1);
$idImage = $product->getCoverWs();
if ($idImage) {
$idImage = $product->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$templateVars = array();
$templateVars['{firstname}'] = $row['firstname'];
$templateVars['{product_url}'] = $product->getLink();
$templateVars['{product_name}'] = $product->name;
$templateVars['{image_link}'] = $link->getImageLink($product->link_rewrite, $idImage, 'list');
$mailTo = $row['email'];
echo "" . $count . " : " . $mailTo . "\n";
$subject = $row['firstname'] . ", you left your shopping bag with us";
@Mail::Send(1, 'abandoned', $subject, $templateVars, $mailTo, $row['firstname'], 'care@indusdiva.com', 'Indusdiva.com', NULL, NULL, _PS_MAIL_DIR_, false);
usleep(200000);
}
}
示例2: sendWishlistMails
function sendWishlistMails()
{
global $link;
$sql = "SELECT w.id_product, cc.email, cc.`firstname`, cc.id_customer\n\tFROM `ps_wishlist` w\n\tINNER JOIN ps_customer cc ON cc.`id_customer` = w.`id_customer`\n\tINNER JOIN ps_product p ON p.id_product = w.id_product\n\tLEFT JOIN ps_orders o ON o.`id_customer` = cc.`id_customer`\n\tWHERE o.id_customer IS NULL\n\tAND p.`quantity` > 0\n\tAND p.active = 1\n\tAND cc.newsletter = 0\n\tOR cc.id_customer = 1\n\tGROUP BY cc.`id_customer`";
/*$sql = "SELECT w.id_product, cc.email, cc.`firstname`, cc.id_customer
FROM `ps_wishlist` w
INNER JOIN ps_customer cc ON cc.`id_customer` = w.`id_customer`
INNER JOIN ps_product p ON p.id_product = w.id_product
LEFT JOIN ps_orders o ON o.`id_customer` = cc.`id_customer`
WHERE cc.id_customer in (1)
AND p.`quantity` > 0
AND p.active = 1
GROUP BY cc.`id_customer`";*/
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
$count = 0;
foreach ($res as $row) {
$count++;
$id_product = $row['id_product'];
$product = new Product($id_product, true, 1);
$idImage = $product->getCoverWs();
if ($idImage) {
$idImage = $product->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$templateVars = array();
$templateVars['{firstname}'] = $row['firstname'];
$templateVars['{product_url}'] = $product->getLink();
$templateVars['{product_name}'] = $product->name;
$templateVars['{image_link}'] = $link->getImageLink($product->link_rewrite, $idImage, 'list');
$mailTo = $row['email'];
echo "" . $count . " : " . $mailTo . "\n";
$subject = $row['firstname'] . ", Let your Wishlist Come True";
@Mail::Send(1, 'wishlistreminder', $subject, $templateVars, $mailTo, $row['firstname'], 'care@indusdiva.com', 'Indusdiva.com', NULL, NULL, _PS_MAIL_DIR_, true);
usleep(200000);
}
}
示例3: makeMenu
protected function makeMenu()
{
$root_node = $this->makeNode(['label' => null, 'type' => 'root', 'children' => []]);
$menu_items = $this->getMenuItems();
$id_lang = (int) $this->context->language->id;
$id_shop = (int) Shop::getContextShopID();
foreach ($menu_items as $item) {
if (!$item) {
continue;
}
preg_match($this->pattern, $item, $value);
$id = (int) substr($item, strlen($value[1]), strlen($item));
switch (substr($item, 0, strlen($value[1]))) {
case 'CAT':
$categories = $this->generateCategoriesMenu(Category::getNestedCategories($id, $id_lang, false, $this->user_groups));
$root_node['children'] = array_merge($root_node['children'], $categories);
break;
case 'PRD':
$product = new Product((int) $id, true, (int) $id_lang);
if ($product->id) {
$root_node['children'][] = $this->makeNode(['type' => 'product', 'page_identifier' => 'product-' . $product->id, 'label' => $product->name, 'url' => $product->getLink()]);
}
break;
case 'CMS':
$cms = CMS::getLinks((int) $id_lang, array($id));
if (count($cms)) {
$root_node['children'][] = $this->makeNode(['type' => 'cms-page', 'page_identifier' => 'cms-page-' . $id, 'label' => $cms[0]['meta_title'], 'url' => $cms[0]['link']]);
}
break;
case 'CMS_CAT':
$root_node['children'][] = $this->generateCMSCategoriesMenu((int) $id, (int) $id_lang);
break;
// Case to handle the option to show all Manufacturers
// Case to handle the option to show all Manufacturers
case 'ALLMAN':
$children = array_map(function ($manufacturer) use($id_lang) {
return $this->makeNode(['type' => 'manufacturer', 'page_identifier' => 'manufacturer-' . $manufacturer['id_manufacturer'], 'label' => $manufacturer['name'], 'url' => $this->context->link->getManufacturerLink(new Manufacturer($manufacturer['id_manufacturer'], $id_lang), null, $id_lang)]);
}, Manufacturer::getManufacturers());
$root_node['children'][] = $this->makeNode(['type' => 'manufacturers', 'page_identifier' => 'manufacturers', 'label' => $this->l('All manufacturers'), 'url' => $this->context->link->getPageLink('manufacturer'), 'children' => $children]);
break;
case 'MAN':
$manufacturer = new Manufacturer($id, $id_lang);
if ($manufacturer->id) {
$root_node['children'][] = $this->makeNode(['type' => 'manufacturer', 'page_identifier' => 'manufacturer-' . $manufacturer->id, 'label' => $manufacturer->name, 'url' => $this->context->link->getManufacturerLink($manufacturer, null, $id_lang)]);
}
break;
// Case to handle the option to show all Suppliers
// Case to handle the option to show all Suppliers
case 'ALLSUP':
$children = array_map(function ($supplier) use($id_lang) {
return $this->makeNode(['type' => 'supplier', 'page_identifier' => 'supplier-' . $supplier['id_supplier'], 'label' => $supplier['name'], 'url' => $this->context->link->getSupplierLink(new Supplier($supplier['id_supplier'], $id_lang), null, $id_lang)]);
}, Supplier::getSuppliers());
$root_node['children'][] = $this->makeNode(['type' => 'suppliers', 'page_identifier' => 'suppliers', 'label' => $this->l('All suppliers'), 'url' => $this->context->link->getPageLink('supplier'), 'children' => $children]);
break;
case 'SUP':
$supplier = new Supplier($id, $id_lang);
if ($supplier->id) {
$root_node['children'][] = $this->makeNode(['type' => 'supplier', 'page_identifier' => 'supplier-' . $supplier->id, 'label' => $supplier->name, 'url' => $this->context->link->getSupplierLink($supplier, null, $id_lang)]);
}
break;
case 'SHOP':
$shop = new Shop((int) $id);
if (Validate::isLoadedObject($shop)) {
$root_node['children'][] = $this->makeNode(['type' => 'shop', 'page_identifier' => 'shop-' . $id, 'label' => $shop->name, 'url' => $shop->getBaseURL()]);
}
break;
case 'LNK':
$link = Ps_MenuTopLinks::get($id, $id_lang, $id_shop);
if (!empty($link)) {
if (!isset($link[0]['label']) || $link[0]['label'] == '') {
$default_language = Configuration::get('PS_LANG_DEFAULT');
$link = Ps_MenuTopLinks::get($link[0]['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
}
$root_node['children'][] = $this->makeNode(['type' => 'link', 'page_identifier' => $link[0]['link'], 'label' => $link[0]['label'], 'url' => $link[0]['link'], 'open_in_new_window' => $link[0]['new_window']]);
}
break;
}
}
return $this->mapTree(function ($node, $depth) {
$node['depth'] = $depth;
return $node;
}, $root_node);
}
示例4: postProcess
public function postProcess()
{
global $currentIndex, $cookie, $smarty;
if (Tools::getValue('approve')) {
$id_comment = Tools::getValue('reviewID');
$comment = new ProductComment((int) $id_comment);
$comment->validate = 1;
$comment->update();
$product = new Product($comment->id_product, true, (int) $cookie->id_lang);
$customer = new Customer($comment->id_customer);
//send mail notifications
Mail::Send((int) $cookie->id_lang, 'review_approved', Mail::l('Your product review for ' . $product->name), array('{product_name}' => $product->name, '{firstname}' => $customer->firstname, '{product_url}' => $product->getLink()), $customer->email, $customer->firstname . ' ' . $customer->lastname);
//queue reward rule exec
if (!product_review_approved::rewardExistsForReference($comment->id_customer, EVENT_REVIEW_APPROVED, 3, $comment->id_product)) {
Tools::sendSQSRuleMessage(EVENT_REVIEW_APPROVED, $comment->id_product, $comment->id_customer, date('Y-m-d H:i:s'));
}
}
if (Tools::getValue('disapprove')) {
$id_comment = Tools::getValue('reviewID');
$comment = new ProductComment((int) $id_comment);
$comment->deleted = 1;
$comment->update();
$product = new Product($comment->id_product, true, (int) $cookie->id_lang);
$customer = new Customer($comment->id_customer);
//send mail notifications
Mail::Send((int) $cookie->id_lang, 'review-reject', Mail::l('Your product review for ' . $product->name), array('{product_name}' => $product->name, '{firstname}' => $customer->firstname, '{product_url}' => $product->getLink()), $customer->email, $customer->firstname . ' ' . $customer->lastname);
}
if (Tools::getValue('restore')) {
$id_comment = Tools::getValue('reviewID');
$comment = new ProductComment((int) $id_comment);
$comment->deleted = 0;
$comment->update();
}
if (Tools::getValue('editReview')) {
$id_comment = Tools::getValue('reviewID');
$reviewContent = Tools::getValue('reviewContent');
$reviewTitle = Tools::getValue('reviewTitle');
$comment = new ProductComment((int) $id_comment);
$comment->content = $reviewContent;
$comment->title = $reviewTitle;
$comment->validate = Tools::getValue('approveReview') ? 1 : 0;
$product = new Product($comment->id_product, true, (int) $cookie->id_lang);
$customer = new Customer($comment->id_customer);
if ($comment->validate) {
//queue reward rule exec
if (!product_review_approved::rewardExistsForReference($comment->id_customer, EVENT_REVIEW_APPROVED, 3, $comment->id_product)) {
Tools::sendSQSRuleMessage(EVENT_REVIEW_APPROVED, $comment->id_product, $comment->id_customer, date('Y-m-d H:i:s'));
}
//send mail notifications
Mail::Send((int) $cookie->id_lang, 'review_approved', Mail::l('Your product review for ' . $product->name), array('{product_name}' => $product->name, '{firstname}' => $customer->firstname, '{product_url}' => $product->getLink()), $customer->email, $customer->firstname . ' ' . $customer->lastname);
}
$comment->update();
}
if (Tools::getValue('view')) {
$id_comment = Tools::getValue('reviewID');
$comment = new ProductComment((int) $id_comment);
$smarty->assign('review', $comment);
}
$p = (int) Tools::getValue('p', 1);
$n = Tools::getValue('n', 20);
$totalReviews = ProductComment::getTotalComments();
$pages = $totalReviews / $n;
if ($totalReviews > $n) {
$smarty->assign('pages', $pages);
}
$comments = ProductComment::getComments($p, $n);
$smarty->assign('reviews', $comments);
$smarty->assign('currentIndex', $currentIndex);
$smarty->assign('token', $this->token);
$smarty->assign('customerToken', Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee));
}
示例5: generateUrl
protected function generateUrl($value, $default = "#", $prefix = '')
{
$response = $default;
if ($prefix) {
$value .= $prefix;
}
if ($value) {
$langId = $this->context->language->id;
$shopId = $this->context->shop->id;
$arr = explode('|', $value);
switch ($arr[0]) {
case 'PRD':
$product = new Product((int) $arr[1], true, (int) $langId);
$response = Tools::HtmlEntitiesUTF8($product->getLink());
break;
case 'CAT':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getCategoryLink((int) $arr[1], null, $langId));
break;
case 'CMS_CAT':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getCMSCategoryLink((int) $arr[1], null, $langId));
break;
case 'CMS':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getCMSLink((int) $arr[1], null, $langId));
break;
case 'ALLMAN':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getPageLink('manufacturer'), true, $langId);
break;
case 'MAN':
$man = new Manufacturer((int) $arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8($this->context->link->getManufacturerLink($man->id, $man->link_rewrite, $langId));
break;
case 'ALLSUP':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getPageLink('supplier'), true, $langId);
break;
case 'SUP':
$sup = new Supplier((int) $arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8($this->context->link->getSupplierLink($sup->id, $sup->link_rewrite, $langId));
break;
case 'SHO':
$shop = new Shop((int) $key);
$response = $shop->getBaseURL();
break;
case 'PAG':
$pag = Meta::getMetaByPage($arr[1], $langId);
if (strpos($pag['page'], 'module-') === false) {
$response = Tools::HtmlEntitiesUTF8($this->context->link->getPageLink($pag['page'], true, $langId));
} else {
$page = explode('-', $pag['page']);
Context::getContext()->link->getModuleLink($page[1], $page[2]);
$response = Tools::HtmlEntitiesUTF8($this->context->link->getModuleLink($page[1], $page[2]));
}
break;
default:
break;
}
}
return $response;
}
示例6: makeMobileMenu
private function makeMobileMenu($item)
{
$listofthisfrontmenu = '';
$id_lang = (int) $this->context->language->id;
$id_shop = (int) Shop::getContextShopID();
preg_match($this->pattern, $item, $values);
$id = (int) substr($item, strlen($values[1]), strlen($item));
switch (substr($item, 0, strlen($values[1]))) {
case 'CAT':
$this->_mmenu .= $this->getCatMobileOption((int) $id);
break;
case 'PRD':
$selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
$product = new Product((int) $id, true, (int) $id_lang);
if (!is_null($product->id)) {
$this->_mmenu .= '<option value="' . $product->getLink() . '">' . $product->name . '</option>' . PHP_EOL;
}
break;
case 'CMS':
$selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? '' : '';
$cms = CMS::getLinks((int) $id_lang, array($id));
if (count($cms)) {
$this->_mmenu .= '<option value="' . $cms[0]['link'] . '">' . $cms[0]['meta_title'] . '</option>' . PHP_EOL;
}
break;
case 'CMS_CAT':
$category = new CMSCategory((int) $id, (int) $id_lang);
if (count($category)) {
$this->_mmenu .= '<option value="' . $category->getLink() . '"><span class="errow"></span><span>' . $category->name . '</option>';
$this->getCMSMenuItems($category->id);
}
break;
case 'MAN':
$selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
$manufacturer = new Manufacturer((int) $id, (int) $id_lang);
if (!is_null($manufacturer->id)) {
if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
$manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
} else {
$manufacturer->link_rewrite = 0;
}
$link = new Link();
$this->_mmenu .= '<option value="' . htmlentities($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '">' . $manufacturer->name . '</option>' . PHP_EOL;
}
break;
case 'SUP':
$selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
$supplier = new Supplier((int) $id, (int) $id_lang);
if (!is_null($supplier->id)) {
$link = new Link();
$this->_mmenu .= '<option value="' . $link->getSupplierLink((int) $id, $supplier->link_rewrite) . '">' . $supplier->name . '</option>' . PHP_EOL;
}
break;
case 'LNK':
$link = TdMegaMenu::getCustomLinksByid((int) $id, (int) $id_lang, (int) $id_shop);
if (count($link)) {
if (!isset($link[0]['label']) || $link[0]['label'] == '') {
$default_language = Configuration::get('PS_LANG_DEFAULT');
$link = TdMegaMenu::getCustomLinksByid($link[0]['id_tdmegamenu'], (int) $default_language, (int) Shop::getContextShopID());
}
$listofthisfrontmenu .= '<option value="' . $link[0]['menu_link'] . '">' . $link[0]['menu_title'] . '</option>' . PHP_EOL;
if ($link[0]['custome_type'] == 'cus_html') {
$this->_mmenu .= html_entity_decode($link[0]['description']);
}
}
break;
case 'SHOP':
$selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' class="sfHover"' : '';
$shop = new Shop((int) $id);
if (Validate::isLoadedObject($shop)) {
$link = new Link();
$this->_mmenu .= '<option value="' . $shop->getBaseURL() . '">' . $shop->name . '</option>' . PHP_EOL;
}
break;
}
return $listofthisfrontmenu;
}
示例7: generationUrl
public static function generationUrl()
{
$value = Tools::getValue('value');
$response = '';
if ($value) {
$langId = Context::getContext()->language->id;
$shopId = Context::getContext()->shop->id;
$arr = explode('-', $value);
switch ($arr[0]) {
case 'PRD':
$product = new Product((int) $arr[1], true, (int) $langId);
$response = Tools::HtmlEntitiesUTF8($product->getLink());
break;
case 'CAT':
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getCategoryLink((int) $arr[1], null, $langId));
break;
case 'CMS_CAT':
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getCMSCategoryLink((int) $arr[1], null, $langId));
break;
case 'CMS':
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getCMSLink((int) $arr[1], null, $langId));
break;
case 'ALLMAN':
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getPageLink('manufacturer'), true, $langId);
break;
case 'MAN':
$man = new Manufacturer((int) $arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getManufacturerLink($man->id, $man->link_rewrite, $langId));
break;
case 'ALLSUP':
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getPageLink('supplier'), true, $langId);
break;
case 'SUP':
$sup = new Supplier((int) $arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getSupplierLink($sup->id, $sup->link_rewrite, $langId));
break;
case 'PAG':
$pag = Meta::getMetaByPage($arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8(Context::getContext()->link->getPageLink($pag['page'], true, $langId));
break;
case 'SHO':
$shop = new Shop((int) $key);
$response = $shop->getBaseURL();
break;
default:
$response = '#';
break;
}
} else {
$response = '#';
}
die(Tools::jsonEncode($response));
}
示例8: process
//.........这里部分代码省略.........
$cover['id_image'] = Configuration::get('PS_LEGACY_IMAGES') ? $this->product->id . '-' . $image['id_image'] : $image['id_image'];
$cover['id_image_only'] = (int) $image['id_image'];
}
$productImages[(int) $image['id_image']] = $image;
}
if (!isset($cover)) {
$cover = array('id_image' => Language::getIsoById(self::$cookie->id_lang) . '-default', 'legend' => 'No picture', 'title' => 'No picture');
}
$size = Image::getSize('large');
self::$smarty->assign(array('cover' => $cover, 'imgWidth' => (int) $size['width'], 'mediumSize' => Image::getSize('medium'), 'largeSize' => Image::getSize('large'), 'accessories' => $this->product->getAccessories((int) self::$cookie->id_lang)));
if (sizeof($productImages)) {
self::$smarty->assign('images', $productImages);
}
if ((int) Tools::getValue('pp') == 1) {
$time5 = time();
echo 'time5: ' . $time5;
}
/* Attributes / Groups & colors */
$colors = array();
//see if the product has shades
if ($this->product->id_group && $this->product->id_group > 0) {
global $link;
$related_productIds = $this->product->getRelatedProducts();
$related_products = array();
foreach ($related_productIds as &$productId) {
$relProduct = new Product((int) $productId['id_product'], true, self::$cookie->id_lang);
$idImage = $relProduct->getCoverWs();
if ($idImage) {
$idImage = $relProduct->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$relProduct->image_link = $link->getImageLink($relProduct->link_rewrite, $idImage, 'small');
$relProduct->link = $relProduct->getLink();
$related_products[] = $relProduct;
}
self::$smarty->assign('relatedProducts', $related_products);
}
if ((int) Tools::getValue('pp') == 1) {
$time6 = time();
echo 'time6: ' . $time6;
}
$attributesGroups = $this->product->getAttributesGroups((int) self::$cookie->id_lang);
// @todo (RM) should only get groups and not all declination ?
if (is_array($attributesGroups) and $attributesGroups) {
$groups = array();
$combinationImages = $this->product->getCombinationImages((int) self::$cookie->id_lang);
foreach ($attributesGroups as $k => $row) {
/* Color management */
if ((isset($row['attribute_color']) and $row['attribute_color'] or file_exists(_PS_COL_IMG_DIR_ . $row['id_attribute'] . '.jpg')) and $row['id_attribute_group'] == $this->product->id_color_default) {
$colors[$row['id_attribute']]['value'] = $row['attribute_color'];
$colors[$row['id_attribute']]['name'] = $row['attribute_name'];
if (!isset($colors[$row['id_attribute']]['attributes_quantity'])) {
$colors[$row['id_attribute']]['attributes_quantity'] = 0;
}
$colors[$row['id_attribute']]['attributes_quantity'] += (int) $row['quantity'];
}
if (!isset($groups[$row['id_attribute_group']])) {
$groups[$row['id_attribute_group']] = array('name' => $row['public_group_name'], 'is_color_group' => $row['is_color_group'], 'default' => -1);
}
$groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name'];
if ($row['default_on'] && $groups[$row['id_attribute_group']]['default'] == -1) {
$groups[$row['id_attribute_group']]['default'] = (int) $row['id_attribute'];
}
if (!isset($groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']])) {
$groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
示例9: getProductLink
private function getProductLink($product_id)
{
if (isset($this->context) && isset($this->context->link) && method_exists($this->context->link, 'getProductLink')) {
return $this->context->link->getProductLink((int) $product_id);
}
global $link;
if (isset($link) && method_exists($link, 'getProductLink')) {
return $link->getProductLink((int) $product_id);
} else {
$full_product = new Product((int) $product_id, false);
return $full_product->getLink();
}
}
示例10: makeMenu
private function makeMenu()
{
global $cookie, $page_name;
$curr_level = 1;
foreach ($this->getMenuItems() as $key => $item) {
extract($item);
if ($depth > $curr_level) {
$this->_menu .= '<ul>';
}
if ($depth == $curr_level && $key != 0) {
$this->_menu .= '</li>';
}
if ($depth < $curr_level) {
$this->_menu .= str_repeat('</li></ul>', $curr_level - $depth) . '</li>';
}
$curr_level = $depth;
switch ($type) {
case 'CAT':
$this->getCategory($id_ref, $cookie->id_lang);
break;
case 'PRD':
$selected = $page_name == 'product' && Tools::getValue('id_product') == $id_ref ? ' class="sfHover"' : '';
$product = new Product($id_ref, true, $cookie->id_lang);
if (!is_null($product->id)) {
$this->_menu .= '<li' . $selected . '><a href="' . $product->getLink() . '"><span>' . $product->name . '</span></a>' . PHP_EOL;
}
break;
case 'CCS':
$selected = $page_name == 'cms' && Tools::getValue('id_cms_category') == $id_ref ? ' class="sfHover"' : '';
$_this_cat = new CMSCategory($id_ref, $cookie->id_lang);
$link = new Link();
$this->_menu .= '<li' . $selected . '><a href="' . $link->getCMSCategoryLink($_this_cat->id, $_this_cat->link_rewrite) . '"><span>' . htmlentities($_this_cat->name) . '
</span></a>' . PHP_EOL;
break;
case 'CMS':
$selected = $page_name == 'cms' && Tools::getValue('id_cms') == $id_ref ? ' class="sfHover"' : '';
$cms = CMS::getLinks($cookie->id_lang, array($id_ref));
if (count($cms)) {
$this->_menu .= '<li' . $selected . '><a href="' . $cms[0]['link'] . '"><span>' . htmlentities($cms[0]['meta_title']) . '</span></a>' . PHP_EOL;
}
break;
case 'MAN':
$selected = $page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id_ref ? ' class="sfHover"' : '';
$manufacturer = new Manufacturer($id_ref, $cookie->id_lang);
if (!is_null($manufacturer->id)) {
if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
$manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false);
} else {
$manufacturer->link_rewrite = 0;
}
$link = new Link();
$this->_menu .= '<li' . $selected . '><a href="' . $link->getManufacturerLink($id_ref, $manufacturer->link_rewrite) . '">' . $manufacturer->name . '</a>' . PHP_EOL;
}
break;
case 'SUP':
$selected = $page_name == 'supplier' && Tools::getValue('id_supplier') == $id_ref ? ' class="sfHover"' : '';
$supplier = new Supplier($id_ref, $cookie->id_lang);
if (!is_null($supplier->id)) {
$link = new Link();
$this->_menu .= '<li' . $selected . '><a href="' . $link->getSupplierLink($id_ref, $supplier->link_rewrite) . '"><span>' . $supplier->name . '</span></a>' . PHP_EOL;
}
break;
case 'LNK':
$link = WPMenuTopLinks::get($id_ref, $cookie->id_lang);
if (count($link)) {
$this->_menu .= '<li><a href="' . $link[0]['link'] . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</span></a>' . PHP_EOL;
}
break;
}
}
$this->_menu .= str_repeat('</li></ul>', $curr_level - 1) . '</li>';
}
示例11: _getCSVFileText
private function _getCSVFileText()
{
$link = new Link();
$schema = '';
$schema .= $this->quoting . $this->_idealocsv->l('id', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('brand', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('title', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('Category', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('Short Description', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('description', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('image_link', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('link', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('price', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('ean', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('availability', 'idealo') . $this->quoting . $this->fieldseparator;
foreach ($this->shipping as $ship) {
if ($ship['active'] == '1') {
foreach ($this->payment as $pay) {
if ($pay['active'] == '1') {
$schema .= $this->quoting . strtoupper($pay['db']) . '_' . $ship['country'] . $this->quoting . $this->fieldseparator;
}
}
}
}
foreach ($this->shipping as $ship) {
if ($ship['active'] == '1') {
$schema .= $this->quoting . $this->_idealocsv->l('shipping', 'idealo') . '_' . $ship['country'] . $this->quoting . $this->fieldseparator;
}
}
$schema .= $this->quoting . $this->_idealocsv->l('shipping_weight', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('baseprice', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('EAN', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . $this->_idealocsv->l('condition', 'idealo') . $this->quoting . $this->fieldseparator . $this->quoting . 'portocomment' . $this->quoting . $this->fieldseparator;
if ($this->minOrderPrice != '') {
$schema .= $this->quoting . $this->_idealocsv->l('Small order value surcharge', 'idealo') . $this->quoting . $this->fieldseparator;
}
$schema .= $this->quoting . 'Attributes' . $this->quoting . $this->fieldseparator;
$schema .= "\n";
setlocale(LC_ALL, 'de_DE');
$date = date("d.m.y H:i:s");
$schema .= $this->quoting . sprintf($this->_idealocsv->l('Last file created on %s o\'clock', 'idealo'), $date) . $this->quoting . $this->fieldseparator;
$schema .= "\n";
$schema .= sprintf($this->_idealocsv->l('idealo - CSV export-modul V %s for PrestaShop from %s', 'idealo'), IDEALO_MODULE_VERSION, IDEALO_MODULE_DATE);
$schema .= "\n";
$article = $this->getArticleNumbers();
foreach ($article as $a) {
$product = new Product($a['id_product'], false, $this->id_lang);
$productlink = $product->getLink();
if ($this->campaign == '1') {
$productlink .= CAMPAIGN;
}
$cat = $product->getProductCategoriesFull($a['id_product'], $this->id_lang);
$brand = $this->getBrand($product->id_manufacturer);
$cat_text = $this->getCatText($cat);
if ($this->checkFilter($cat_text, $brand, $a['id_product']) === true) {
$images = $product->getCover($a['id_product']);
$imagelink = $link->getImageLink($product->link_rewrite[1], $product->id . '-' . $images['id_image'], '');
$price = number_format($product->getprice(), 2, '.', '');
$attributeCombinations = $product->getAttributeCombinaisons($this->id_lang);
if (!empty($attributeCombinations)) {
$attributeCombinations = $this->sortAttributeCombinations($attributeCombinations);
$taxRate = $this->getTaxRate($product->id_tax_rules_group);
$i = 1;
foreach ($attributeCombinations as $combination) {
if ($combination[0]['quantity'] > 0) {
$image = '';
$image_id = $this->getImegeLinkOfAtrribute($combination[0]['id_product_attribute']);
if ($image_id == 0) {
$image = $imagelink;
} else {
$image = new Image($image_id);
$image = _PS_BASE_URL_ . _THEME_PROD_DIR_ . $image->getExistingImgPath() . '.jpg';
}
$articleId = $a['id_product'] . '_' . $i;
$combinationString = $this->getCombinationString($combination);
$title = $product->name . ' ' . str_replace(';', ',', $combinationString);
$combinationPrice = $price + number_format($combination[0]['price'] * (1 + $taxRate / 100), 2, '.', '');
$weight = $product->weight + $combination[0]['weight'];
$combinationEan = $combination[0]['ean13'];
$schema .= $this->getProductLine($product, $articleId, $brand, $title, $cat_text, $image, $productlink, $combinationPrice, $weight, $combinationString, ${$combinationEan});
}
$i++;
if ($i >= 100) {
break;
}
}
} else {
$schema .= $this->getProductLine($product, $a['id_product'], $brand, $product->name, $cat_text, $imagelink, $productlink, $price, $product->weight);
}
}
}
return $schema;
}
示例12: getProductDoc
//.........这里部分代码省略.........
$indexed_colors[] = strtolower(preg_replace('/\\s+/', '-', trim($color)));
}
$doc->color = $indexed_colors;
}
if (isset($productObj->stone) && !empty($productObj->stone)) {
$stones = explode(',', $productObj->stone);
$indexed_stones = array();
foreach ($stones as $stone) {
$indexed_stones[] = strtolower(preg_replace('/\\s+/', '-', trim($stone)));
}
$doc->stone = $indexed_stones;
}
if (isset($productObj->plating) && !empty($productObj->plating)) {
$platings = explode(',', $productObj->plating);
$indexed_platings = array();
foreach ($platings as $plating) {
$indexed_platings[] = strtolower(preg_replace('/\\s+/', '-', trim($plating)));
}
$doc->plating = $indexed_platings;
}
if (isset($productObj->material) && !empty($productObj->material)) {
$materials = explode(',', $productObj->material);
$indexed_materials = array();
foreach ($materials as $material) {
$indexed_materials[] = strtolower(preg_replace('/\\s+/', '-', trim($material)));
}
$doc->material = $indexed_materials;
}
if (isset($productObj->look) && !empty($productObj->look)) {
$looks = explode(',', $productObj->look);
$indexed_looks = array();
foreach ($looks as $look) {
$indexed_looks[] = strtolower(preg_replace('/\\s+/', '-', trim($look)));
}
$doc->look = $indexed_looks;
}
if (isset($productObj->handbag_occasion) && !empty($productObj->handbag_occasion)) {
$handbag_occasions = explode(',', $productObj->handbag_occasion);
$indexed_handbag_occasions = array();
foreach ($handbag_occasions as $handbag_occasion) {
$indexed_handbag_occasions[] = strtolower(preg_replace('/\\s+/', '-', trim($handbag_occasion)));
}
$doc->handbag_occasion = $indexed_handbag_occasions;
}
if (isset($productObj->handbag_style) && !empty($productObj->handbag_style)) {
$handbag_styles = explode(',', $productObj->handbag_style);
$indexed_handbag_styles = array();
foreach ($handbag_styles as $handbag_style) {
$indexed_handbag_styles[] = strtolower(preg_replace('/\\s+/', '-', trim($handbag_style)));
}
$doc->handbag_style = $indexed_handbag_styles;
}
if (isset($productObj->handbag_material) && !empty($productObj->handbag_material)) {
$handbag_materials = explode(',', $productObj->handbag_material);
$indexed_handbag_materials = array();
foreach ($handbag_materials as $handbag_material) {
$indexed_handbag_materials[] = strtolower(preg_replace('/\\s+/', '-', trim($handbag_material)));
}
$doc->handbag_material = $indexed_handbag_materials;
}
$combinaisons = $productObj->getAttributeCombinaisons(1);
$indexed_sizes = array();
foreach ($combinaisons as $k => $combinaison) {
if ($combinaison['group_name'] == 'size' || $combinaison['group_name'] == 'Size') {
$indexed_sizes[] = $combinaison['attribute_name'];
}
}
$doc->size = $indexed_sizes;
//Indian Price
$doc->offer_price_in = Product::getPriceStatic($productObj->id, true, NULL, 6, NULL, false, true, 1, false, NULL, NULL, IND_ADDRESS_ID);
$doc->offer_price_in_rs = Tools::convertPrice($doc->offer_price_in, 4);
$doc->mrp_in = Product::getPriceStatic($productObj->id, true, NULL, 6, NULL, false, false, 1, false, NULL, NULL, IND_ADDRESS_ID);
if ($doc->mrp_in > $doc->offer_price_in) {
$doc->discount_in = Tools::ps_round(($doc->mrp_in - $doc->offer_price_in) / $doc->mrp_in * 100);
}
//Worldwide Price
$doc->offer_price = $productObj->getPrice();
$doc->offer_price_rs = Tools::convertPrice($doc->offer_price, 4);
$doc->mrp = $productObj->getPriceWithoutReduct();
if ($doc->mrp > $doc->offer_price) {
$doc->discount = Tools::ps_round(($doc->mrp - $doc->offer_price) / $doc->mrp * 100);
}
$doc->product_link = $productObj->getLink();
$idImage = $productObj->getCoverWs();
if ($idImage) {
$idImage = $productObj->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$doc->image_link_list = $link->getImageLink($productObj->link_rewrite, $idImage, 'list');
$doc->image_link_medium = $link->getImageLink($productObj->link_rewrite, $idImage, 'medium');
$doc->image_link_large = $link->getImageLink($productObj->link_rewrite, $idImage, 'large');
$images = $productObj->getImages(1);
$productImages = array();
foreach ($images as $k => $image) {
$productImages[] = $link->getImageLink($productObj->link_rewrite, $image['id_image'], 'large');
}
$doc->image_links = $productImages;
return $doc;
}
示例13: getMenuCustomerLink
public function getMenuCustomerLink($lang_id = NULL)
{
$menu_items = $this->getMenuItems();
$id_lang = (int) $this->context->language->id;
$id_shop = (int) Shop::getContextShopID();
foreach ($menu_items as $item) {
if (!$item) {
continue;
}
preg_match($this->pattern, $item, $value);
$id = (int) substr($item, strlen($value[1]), strlen($item));
switch (substr($item, 0, strlen($value[1]))) {
case 'CAT':
$this->_menuLink .= $this->drawCustomMenuItem($id, 0, false, 0, $lang_id);
break;
case 'PRD':
$selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
$product = new Product((int) $id, true, (int) $id_lang);
if (!is_null($product->id)) {
$this->_menuLink .= '<div id ="pt_menu_product" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($product->getLink()) . '"><span>' . $product->name . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'CMS':
$selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' class="sfHover"' : '';
$cms = CMS::getLinks((int) $id_lang, array($id));
if (count($cms)) {
$this->_menuLink .= '<div id ="pt_menu_cms" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($cms[0]['link']) . '"><span>' . $cms[0]['meta_title'] . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'CMS_CAT':
$category = new CMSCategory((int) $id, (int) $id_lang);
if (Validate::isLoadedObject($category)) {
$this->_menuLink .= '<div id ="pt_menu_cms" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($category->getLink()) . '"><span>' . $category->name . '</span></a>';
}
$this->_menuLink .= '</div>' . PHP_EOL;
$this->_menuLink .= $this->getCMSMenuItems($category->id);
// Case to handle the option to show all Manufacturers
// Case to handle the option to show all Manufacturers
case 'ALLMAN':
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_allsub" class ="pt_menu"><div class="parentMenu" ><a href="' . $link->getPageLink('manufacturer') . '" ><span>' . $this->l('All manufacturers') . '</span></a></div>' . PHP_EOL;
$manufacturers = Manufacturer::getManufacturers();
$this->_menuLink .= '<div class ="popup" style ="display:none">';
foreach ($manufacturers as $key => $manufacturer) {
$this->_menuLink .= '<div class ="block1"><div class="column col1"><div class="itemSubMenu level3"><a href="' . $link->getManufacturerLink((int) $manufacturer['id_manufacturer'], $manufacturer['link_rewrite']) . '">' . $manufacturer['name'] . '</a></div></div></div>' . PHP_EOL;
}
$this->_menuLink .= '</div></div>';
break;
case 'MAN':
$selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
$manufacturer = new Manufacturer((int) $id, (int) $id_lang);
if (!is_null($manufacturer->id)) {
if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
$manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
} else {
$manufacturer->link_rewrite = 0;
}
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_man" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '"><span>' . $manufacturer->name . '</span></a></div></div>' . PHP_EOL;
}
break;
// Case to handle the option to show all Suppliers
// Case to handle the option to show all Suppliers
case 'ALLSUP':
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_allsub" class ="pt_menu"><div class="parentMenu" ><a href="' . $link->getPageLink('supplier') . '" ><span>' . $this->l('All suppliers') . '</span></a></div>' . PHP_EOL;
$suppliers = Supplier::getSuppliers();
$this->_menuLink .= '<div class ="popup" style ="display:none">';
foreach ($suppliers as $key => $supplier) {
$this->_menuLink .= '<div class ="block1"><div class="column col1"><div class="itemSubMenu level3"><a href="' . $link->getSupplierLink((int) $supplier['id_supplier'], $supplier['link_rewrite']) . '">' . $supplier['name'] . '</a></div></div></div>' . PHP_EOL;
}
$this->_menuLink .= '</div></div>';
break;
case 'SUP':
$selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
$supplier = new Supplier((int) $id, (int) $id_lang);
if (!is_null($supplier->id)) {
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_sub" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link->getSupplierLink((int) $id, $supplier->link_rewrite)) . '"><span>' . $supplier->name . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'SHOP':
$selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' class="sfHover"' : '';
$shop = new Shop((int) $id);
if (Validate::isLoadedObject($shop)) {
$link = new Link();
$this->_menuLink .= '<div id ="pt_menu_sub" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($shop->getBaseURL()) . '"><span>' . $supplier->name . '</span></a></div></div>' . PHP_EOL;
}
break;
case 'LNK':
$link = VegaTopLinks::get((int) $id, (int) $id_lang, (int) $id_shop);
if (count($link)) {
if (!isset($link[0]['label']) || $link[0]['label'] == '') {
$default_language = Configuration::get('PS_LANG_DEFAULT');
$link = VegaTopLinks::get($link[0]['id_linksvegatop'], $default_language, (int) Shop::getContextShopID());
}
$this->_menuLink .= '<div id ="pt_ver_menu_link" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link[0]['link']) . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</a></span></div></div>' . PHP_EOL;
}
break;
}
//.........这里部分代码省略.........
示例14: hookOrderConfirmation
/**
* Execute hook
*
* @param mixed $params
*/
public function hookOrderConfirmation($params)
{
global $smarty, $cookie, $link;
if (!$this->active) {
return;
}
// seting error handler
eval('function itembaseErrorHandler($errno, $errstr, $errfile, $errline) {
' . ((bool) Configuration::get('PS_ITEMBASE_DEBUG') ? 'echo "
<!--ITEMBASE
".print_r(array($errno, $errstr, $errfile, $errline), true)."ITEMBASE-->
";' : '') . '
return true;
}');
set_error_handler('itembaseErrorHandler', E_ALL);
try {
include_once rtrim(_PS_MODULE_DIR_, '/') . '/itembase/plugindata.php';
include_once rtrim(_PS_MODULE_DIR_, '/') . '/itembase/oauth.php';
// geting access token
$responseArray = $this->jsonDecode(authenticateClient(Configuration::get('PS_ITEMBASE_APIKEY'), Configuration::get('PS_ITEMBASE_SECRET')));
if (!isset($responseArray['access_token'])) {
itembaseErrorHandler(0, 'no access_token for ' . Tools::safeOutput(Configuration::get('PS_ITEMBASE_APIKEY')) . ' ' . substr(Tools::safeOutput(Configuration::get('PS_ITEMBASE_SECRET')), 0, 4) . '... ' . PS_ITEMBASE_SERVER_OAUTH . ' ' . print_r($responseArray, true), __FILE__, __LINE__ - 1);
}
// order data gathering
$order = new Order($params['objOrder']->id, NULL);
$currency = Currency::getCurrency((int) $order->id_currency);
$carrier = new Carrier((int) $order->id_carrier);
$language = Language::getLanguage((int) $cookie->id_lang);
$customer = new Customer((int) $order->id_customer);
$address = $customer->getAddresses($cookie->id_lang);
if (is_object($address)) {
$address = (array) $address;
}
if (isset($address['0'])) {
$address = $address['0'];
}
// products data gathering
$allProducts = array();
foreach ($order->getProductsDetail() as $order_detail) {
$product_id = $order_detail['product_id'];
$product = new Product($product_id, true, null);
$cover = Product::getCover($product_id);
$product_img = $link->getImageLink($product->link_rewrite, $product_id . '-' . $cover['id_image']);
if (strpos($product_img, 'http') !== 0) {
$product_img = Tools::getHttpHost(true) . $product_img;
}
$category = new Category($product->id_category_default);
$allProducts[] = array('id' => $order_detail['product_id'], 'category' => $category->name, 'name' => $product->name, 'quantity' => $order_detail['product_quantity'], 'price' => $product->getPrice(true, NULL, 2), 'ean' => $product->ean13, 'isbn' => '', 'asin' => '', 'description' => $product->description_short, 'pic_thumb' => $product_img, 'pic_medium' => $product_img, 'pic_large' => $product_img, 'url' => $product->getLink(), 'presta_lang_id' => $language['id_lang']);
}
$dataForItembase = array('access_token' => $responseArray['access_token'], 'email' => $customer->email, 'firstname' => $customer->firstname, 'lastname' => $customer->lastname, 'street' => $address['address1'] . ($address['address2'] ? ' ' . $address['address2'] : ''), 'zip' => $address['postcode'], 'city' => $address['city'], 'country' => $address['country'], 'phone' => $address['phone'], 'lang' => $language['iso_code'], 'purchase_date' => $order->date_add, 'currency' => $currency['iso_code'], 'total' => $order->total_products_wt, 'order_number' => $order->id, 'customer_id' => $order->id_customer, 'invoice_number' => $order->invoice_number, 'shipping_cost' => $order->total_shipping, 'carrier' => $carrier->name, 'payment_option' => $order->payment, 'is_opt_in' => $customer->newsletter, 'shop_name' => class_exists('Context', false) ? Context::getContext()->shop->name : Configuration::get('PS_SHOP_NAME'), 'products' => $allProducts);
// encoding data
utf8EncodeRecursive($dataForItembase);
$smarty->assign('ibdata', $dataForItembase);
$smarty->assign('ibdatajson', $this->jsonEncode($dataForItembase));
$smarty->assign('ibembedserver', PS_ITEMBASE_SERVER_EMBED);
$smarty->assign('ibhostserver', PS_ITEMBASE_SERVER_HOST);
$smarty->assign('ibpluginversion', PS_ITEMBASE_PLUGIN_VERSION);
$smarty->assign('ibtop', Configuration::get('PS_ITEMBASE_TOP'));
} catch (Exception $e) {
itembaseErrorHandler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}
// restoring error handler
restore_error_handler();
return $this->display(__FILE__, 'views/templates/front/checkout_plugin.tpl');
}
示例15: elseif
} elseif (in_array(CAT_CHOLIS, $catIds)) {
$category = 'Choli';
} elseif (in_array(CAT_GIFTCARD, $catIds)) {
$category = 'GiftCard';
} elseif (in_array(CAT_JEWELRY, $catIds)) {
$category = 'Jewelry';
} elseif (in_array(CAT_KIDS, $catIds)) {
$category = 'Kids';
} elseif (in_array(CAT_ABAYA, $catIds)) {
$category = 'Abaya';
} elseif (in_array(CAT_MEN, $catIds)) {
$category = 'Men';
} elseif (in_array(CAT_HANDBAG, $catIds)) {
$category = 'Handbag';
}
$doc->product_link = $productObj->getLink();
$idImage = $productObj->getCoverWs();
if ($idImage) {
$idImage = $productObj->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$thickbox_image = $link->getImageLink($productObj->link_rewrite, $idImage, 'thickbox');
$large_image = $link->getImageLink($productObj->link_rewrite, $idImage, 'large');
$id_manufacturer = $productObj->id_manufacturer;
$manufacturer = '';
if (!empty($id_manufacturer)) {
$manufacturer = Manufacturer::getNameById($id_manufacturer);
}
$productRec = array($id_product, $productObj->reference, $productObj->supplier_reference, $productObj->name, $productObj->getLink(), $productObj->getPriceWithoutReduct(), round($productObj->getPrice()), round($mrp_in_rs), round($offer_price_in_rs), strip_tags($productObj->description), '0', $availability, $manufacturer, $category, $categories, $color, $fabric, (int) $productObj->active === 1 ? 'ACTIVE' : 'INACTIVE', $quantity, $productObj->shipping_sla, $productObj->is_customizable, $large_image, $thickbox_image, date('Y-m-d', strtotime($productObj->date_add)));
$images = $productObj->getImages(1);