本文整理汇总了PHP中Product::getCoverWs方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getCoverWs方法的具体用法?PHP Product::getCoverWs怎么用?PHP Product::getCoverWs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::getCoverWs方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->init();
$this->preProcess();
global $cookie, $link;
$id_product = Tools::getValue('id');
$product = new Product($id_product, true, 1);
$id_customer = (isset(self::$cookie->id_customer) and self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0;
if ($id_customer) {
$sql = "select id from ps_wishlist where id_customer = " . $id_customer . " and id_product = " . $product->id;
$res = Db::getInstance()->ExecuteS($sql);
if ($res) {
self::$smarty->assign("in_wishlist", true);
} else {
self::$smarty->assign("in_wishlist", false);
}
} else {
self::$smarty->assign("in_wishlist", false);
}
$idImage = $product->getCoverWs();
if ($idImage) {
$idImage = $productObj->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$image_link = $link->getImageLink($productObj->link_rewrite, $idImage, 'thickbox');
self::$smarty->assign('product', $product);
self::$smarty->assign('imagelink', $image_link);
self::$smarty->assign('productlink', $product->getLink());
die(self::$smarty->display(_PS_THEME_DIR_ . 'quick-view.tpl'));
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: manageEntityDeclinatedImages
protected function manageEntityDeclinatedImages($directory, $normal_image_sizes)
{
$normal_image_size_names = array();
foreach ($normal_image_sizes as $normal_image_size) {
$normal_image_size_names[] = $normal_image_size['name'];
}
// If id is detected
$object_id = $this->wsObject->urlSegment[2];
if (!Validate::isUnsignedId($object_id)) {
throw new WebserviceException('The image id is invalid. Please set a valid id or the "default" value', array(60, 400));
}
// For the product case
if ($this->imageType == 'products') {
// Get available image ids
$available_image_ids = array();
// New Behavior
$languages = Language::getLanguages();
foreach ($languages as $language) {
foreach (Image::getImages($language['id_lang'], $object_id) as $image) {
$available_image_ids[] = $image['id_image'];
}
}
// If an image id is specified
if ($this->wsObject->urlSegment[3] != '') {
if ($this->wsObject->urlSegment[3] == 'bin') {
$currentProduct = new Product($object_id);
$this->wsObject->urlSegment[3] = $currentProduct->getCoverWs();
}
if (!Validate::isUnsignedId($object_id) || !in_array($this->wsObject->urlSegment[3], $available_image_ids)) {
throw new WebserviceException('This image id does not exist', array(57, 400));
} else {
// Check for new image system
$image_id = $this->wsObject->urlSegment[3];
$path = implode('/', str_split((string) $image_id));
$image_size = $this->wsObject->urlSegment[4];
if (file_exists($directory . $path . '/' . $image_id . (strlen($this->wsObject->urlSegment[4]) > 0 ? '-' . $this->wsObject->urlSegment[4] : '') . '.jpg')) {
$filename = $directory . $path . '/' . $image_id . (strlen($this->wsObject->urlSegment[4]) > 0 ? '-' . $this->wsObject->urlSegment[4] : '') . '.jpg';
$orig_filename = $directory . $path . '/' . $image_id . '.jpg';
} else {
$orig_filename = $directory . $object_id . '-' . $image_id . '.jpg';
$filename = $directory . $object_id . '-' . $image_id . '-' . $image_size . '.jpg';
}
}
} else {
if ($this->wsObject->method == 'GET' || $this->wsObject->method == 'HEAD') {
if ($available_image_ids) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $object_id));
foreach ($available_image_ids as $available_image_id) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id' => $available_image_id, 'xlink_resource' => $this->wsObject->wsUrl . 'images/' . $this->imageType . '/' . $object_id . '/' . $available_image_id), false);
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('image', array());
} else {
$this->objOutput->setStatus(404);
$this->wsObject->setOutputEnabled(false);
}
}
}
} else {
$orig_filename = $directory . $object_id . '.jpg';
$image_size = $this->wsObject->urlSegment[3];
$filename = $directory . $object_id . '-' . $image_size . '.jpg';
}
// in case of declinated images list of a product is get
if ($this->output != '') {
return true;
} elseif (isset($image_size) && $image_size != '') {
// Check the given size
if ($this->imageType == 'products' && $image_size == 'bin') {
$filename = $directory . $object_id . '-' . $image_id . '.jpg';
} elseif (!in_array($image_size, $normal_image_size_names)) {
$exception = new WebserviceException('This image size does not exist', array(58, 400));
throw $exception->setDidYouMean($image_size, $normal_image_size_names);
}
if (!file_exists($filename)) {
throw new WebserviceException('This image does not exist on disk', array(59, 500));
}
// Display the resized specific image
$this->imgToDisplay = $filename;
return true;
} elseif (isset($orig_filename)) {
$orig_filename_exists = file_exists($orig_filename);
return $this->manageDeclinatedImagesCRUD($orig_filename_exists, $orig_filename, $normal_image_sizes, $directory);
} else {
return $this->manageDeclinatedImagesCRUD(false, '', $normal_image_sizes, $directory);
}
}
示例5: process
//.........这里部分代码省略.........
}
$images = $this->product->getImages((int) self::$cookie->id_lang);
$productImages = array();
foreach ($images as $k => $image) {
if ($image['cover']) {
self::$smarty->assign('mainImage', $images[0]);
$cover = $image;
$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);
示例6: elseif
$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);
foreach ($images as $image) {
示例7: manageEntityDeclinatedImages
private function manageEntityDeclinatedImages($directory, $normal_image_sizes)
{
$normal_image_size_names = array();
foreach ($normal_image_sizes as $normal_image_size) {
$normal_image_size_names[] = $normal_image_size['name'];
}
// If id is detected
$object_id = $this->wsObject->urlSegment[2];
if (!Validate::isUnsignedId($object_id)) {
throw new WebserviceException('The image id is invalid. Please set a valid id or the "default" value', array(60, 400));
}
// For the product case
if ($this->imageType == 'products') {
// Get available image ids
$available_image_ids = array();
$images = Db::getInstance()->ExecuteS('
SELECT `id_image`, `id_product`
FROM `' . _DB_PREFIX_ . 'image`
WHERE id_product = ' . (int) $object_id . '
ORDER BY `position` ASC');
if ($images) {
foreach ($images as $image) {
$available_image_ids[] = $image['id_image'];
}
}
// Old Behavior
$nodes = scandir($directory);
foreach ($nodes as $node) {
// avoid too much preg_match...
if ($node != '.' && $node != '..' && $node != '.svn') {
preg_match('/^' . intval($object_id) . '-(\\d+)\\.jpg*$/Ui', $node, $matches);
if (isset($matches[1])) {
$available_image_ids[] = $matches[1];
}
}
}
$available_image_ids = array_unique($available_image_ids);
// If an image id is specified
if ($this->wsObject->urlSegment[3] != '') {
if ($this->wsObject->urlSegment[3] == 'bin') {
$currentProduct = new Product($object_id);
$this->wsObject->urlSegment[3] = $currentProduct->getCoverWs();
}
if (!Validate::isUnsignedId($object_id) || !in_array($this->wsObject->urlSegment[3], $available_image_ids)) {
throw new WebserviceException('This image id does not exist', array(57, 400));
} else {
// Check for new image system
$image_id = $this->wsObject->urlSegment[3];
$path = implode('/', str_split((string) $image_id));
$image_size = $this->wsObject->urlSegment[4];
if (file_exists($directory . $path . '/' . $image_id . (strlen($this->wsObject->urlSegment[4]) > 0 ? '-' . $this->wsObject->urlSegment[4] : '') . '.jpg')) {
$filename = $directory . $path . '/' . $image_id . (strlen($this->wsObject->urlSegment[4]) > 0 ? '-' . $this->wsObject->urlSegment[4] : '') . '.jpg';
$orig_filename = $directory . $path . '/' . $image_id . '.jpg';
} else {
$orig_filename = $directory . $object_id . '-' . $image_id . '.jpg';
$filename = $directory . $object_id . '-' . $image_id . '-' . $image_size . '.jpg';
}
}
} elseif ($this->wsObject->method == 'GET' || $this->wsObject->method == 'HEAD') {
if ($available_image_ids) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $object_id));
foreach ($available_image_ids as $available_image_id) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id' => $available_image_id, 'xlink_resource' => $this->wsObject->wsUrl . 'images/' . $this->imageType . '/' . $object_id . '/' . $available_image_id), false);
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('image', array());
} else {
$this->objOutput->setStatus(404);
$this->wsObject->setOutputEnabled(false);
}
}
} else {
$orig_filename = $directory . $object_id . '.jpg';
$image_size = $this->wsObject->urlSegment[3];
$filename = $directory . $object_id . '-' . $image_size . '.jpg';
}
// in case of declinated images list of a product is get
if ($this->output != '') {
return true;
} elseif (isset($image_size) && $image_size != '') {
// Check the given size
if ($this->imageType == 'products' && $image_size == 'bin') {
$filename = $directory . $object_id . '-' . $image_id . '.jpg';
} elseif (!in_array($image_size, $normal_image_size_names)) {
$exception = new WebserviceException('This image size does not exist', array(58, 400));
throw $exception->setDidYouMean($image_size, $normal_image_size_names);
}
if (!file_exists($filename)) {
throw new WebserviceException('This image does not exist on disk', array(59, 500));
}
// Display the resized specific image
$this->imgToDisplay = $filename;
return true;
} elseif (isset($orig_filename)) {
$orig_filename_exists = file_exists($orig_filename);
return $this->manageDeclinatedImagesCRUD($orig_filename_exists, $orig_filename, $normal_image_sizes, $directory);
} else {
return $this->manageDeclinatedImagesCRUD(false, '', $normal_image_sizes, $directory);
}
}
示例8: getProductImageUrl
/**
* Returns the absolute product image url of the primary image.
*
* @param Product|ProductCore $product the product model.
* @param Link|LinkCore $link optional link instance to use instead of the one in current context.
* @return string the url or empty string if could not be generated.
*/
public function getProductImageUrl($product, $link = null)
{
if (is_null($link)) {
$link = Context::getContext()->link;
}
$image_id = $product->getCoverWs();
if ((int) $image_id > 0) {
$image_type = $this->chooseOptimalImageType();
if (!empty($image_type)) {
return $link->getImageLink($product->link_rewrite, $product->id . '-' . $image_id, $image_type);
}
}
return '';
}
示例9: addProducts
//.........这里部分代码省略.........
$doc->garment_type = preg_replace('@[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]@', ' ', $productObj->garment_type ? $productObj->garment_type : '');
}
if (isset($productObj->blouse_length)) {
$doc->blouse_length = $productObj->blouse_length ? $productObj->blouse_length : '';
}
$doc->height = $productObj->height;
$doc->width = $productObj->width;
$atributeQty = Attribute::getAttributeQty($productObj->id);
if ($productObj->quantity > 0 || $atributeQty > 0) {
$doc->inStock = true;
} else {
$doc->inStock = false;
}
$doc->isPlusSize = $productObj->is_plussize ? true : false;
$doc->isRTS = $productObj->is_rts ? true : false;
$doc->quantity = $productObj->quantity ? $productObj->quantity : ($atributeQty ? $atributeQty : 0);
//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);
}
$date = DateTime::createFromFormat('Y-m-d H:i:s', $productObj->date_add);
$doc->date_add = $date->format("Y-m-d\\TG:i:s\\Z");
$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;
$doc->sales = $productScores[$product['id_product']]['score'];
$productObj->fabric = trim($productObj->fabric);
$productObj->fabric = preg_replace('/\\s+/', '-', $productObj->fabric);
$doc->fabric = strtolower($productObj->fabric);
$doc->is_customizable = $productObj->is_customizable;
if (isset($productObj->generic_color) && !empty($productObj->generic_color)) {
$colors = explode(',', $productObj->generic_color);
$indexed_colors = array();
foreach ($colors as $color) {
$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)));
示例10: Product
</head>
<body style="font-size:0.9em">
<table style="font-size:0.9em;border-collapse:collapse; border:1px solid #CCC;">
<tr>
<th> Image</th>
<th> Exclusive </th>
<th></th>
</tr>
<?php
foreach ($products as $product) {
$id_product = $product['id_product'];
$found = 0;
$sproduct = SolrSearch::getProductsForIDs(array($product['id_product']), $found);
if (empty($sproduct)) {
$sproduct = new Product($id_product, true, 1);
$idImage = $sproduct->getCoverWs();
if ($idImage) {
$idImage = $sproduct->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$list_image = $link->getImageLink($sproduct->link_rewrite, $idImage, "medium");
} else {
$list_image = $sproduct[0]['image_link_medium'];
}
if (!empty($product['is_exclusive'])) {
echo "<tr style='background-color:#383; color:#FFF; height:205px' id='trow_{$id_product}'>";
} else {
echo "<tr id='trow_{$id_product}' style='height:205px'>";
}
echo "<td style='text-align:center'><a target='__new' href='http://www.indusdiva.com/{$id_product}-product.html'><img src='" . $list_image . "'/></a></td>";
示例11: 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;
}
示例12: validateOrder
//.........这里部分代码省略.........
$couponCode = $text['value'];
}
}
}
}
}
}
}
//$couponCode = "GC" . Tools::rand_string(8);
// create discount
$languages = Language::getLanguages($order);
$voucher = new Discount();
$voucher->id_discount_type = 2;
foreach ($languages as $language) {
$voucher->description[$language['id_lang']] = $product['name'];
}
$voucher->value = (double) $unitPrice;
$voucher->name = $couponCode;
$voucher->id_currency = 2;
//USD
$voucher->quantity = 1;
$voucher->quantity_per_user = 1;
$voucher->cumulable = 1;
$voucher->cumulable_reduction = 1;
$voucher->minimal = 0;
$voucher->active = 1;
$voucher->cart_display = 0;
$now = time();
$voucher->date_from = date('Y-m-d H:i:s', $now);
$voucher->date_to = date('Y-m-d H:i:s', $now + 3600 * 24 * 365);
/* 365 days */
$voucher->add();
$productObj = new Product($product['id_product'], true, 1);
$idImage = $productObj->getCoverWs();
if ($idImage) {
$idImage = $productObj->id . '-' . $idImage;
} else {
$idImage = Language::getIsoById(1) . '-default';
}
$params = array();
$params['{voucher_code}'] = $voucher->name;
$params['{freinds_name}'] = $friendsName;
$params['{gift_message}'] = $giftMessage;
$params['{product_name}'] = $product['name'];
$params['{voucher_value}'] = $voucher->value;
$params['{image_url}'] = _PS_BASE_URL_ . _PS_IMG_ . 'banners/' . $productObj->location;
$params['{sender_name}'] = $customer->firstname . ' ' . $customer->lastname;
$subject = $friendsName . ', You Have Received A $' . $voucher->value . ' IndusDiva Gift Card';
@Mail::Send(1, 'gift_card', $subject, $params, $friendsEmail, $friendsName, 'care@indusdiva.com', 'Indusdiva.com', NULL, NULL, _PS_MAIL_DIR_, true);
@Mail::Send(1, 'gift_card', $subject, $params, $customer->email, $customer->firstname . ' ' . $customer->lastname, 'care@indusdiva.com', 'Indusdiva.com', NULL, NULL, _PS_MAIL_DIR_, true);
}
}
// end foreach ($products)
$query = rtrim($query, ',');
$result = $db->Execute($query);
// Insert discounts from cart into order_discount table
$discounts = $cart->getDiscounts();
$discountsList = '';
$total_discount_value = 0;
$shrunk = false;
foreach ($discounts as $discount) {
$objDiscount = new Discount((int) $discount['id_discount'], $order->id_lang);
$value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $order->total_shipping, $cart->id);
if ($objDiscount->id_discount_type == 2 || $objDiscount->id_discount_type == 4 and in_array($objDiscount->behavior_not_exhausted, array(1, 2))) {
$shrunk = true;
}