public function preProcess()
 {
     parent::preProcess();
     $customer = new Customer((int) self::$cookie->id_customer);
     if ($idAdd = Tools::getValue('add')) {
         $res = Db::getInstance()->ExecuteS("insert into ps_wishlist(id_customer, id_product) values(" . self::$cookie->id_customer . ", " . $idAdd . ")");
         Tools::captureActivity(PSTAT_ADD_WL, $idAdd);
         Tools::redirect('wishlist.php');
     }
     if ($idDelete = Tools::getValue('delete')) {
         $res = Db::getInstance()->ExecuteS("delete from ps_wishlist where id_customer = " . self::$cookie->id_customer . " and id_product = " . $idDelete);
         Tools::captureActivity(PSTAT_DEL_WL, $idDelete);
         Tools::redirect('wishlist.php');
     }
     $sql = "select id_product from ps_wishlist where id_customer = " . self::$cookie->id_customer;
     $res = Db::getInstance()->ExecuteS($sql);
     if ($res) {
         $productIds = array();
         foreach ($res as $row) {
             $productIds[] = $row['id_product'];
         }
         $total_found = 0;
         try {
             $wishlist_products = SolrSearch::getProductsForIDs($productIds, $total_found, 1, 100);
             self::$smarty->assign('wishlist_products', $wishlist_products);
         } catch (Exception $e) {
         }
     }
 }
Exemplo n.º 2
0
    //region
    $data[] = "Other";
    $patterns = array("Animal Print", "Batik", "Checkered", "Floral", "Geometric", "Ikat", "Paisley", "Polka Dots", "Printed", "Solid", "Stripes", "Tattoo", "batik", "checkered", "floral", "ikat", "paisley", "polka dots", "printed", "solid", "stripes", "checkers", "stripe", "checker", "animal print", "print", "Striped", "Print", "Checker", "Checkers", "Check", "check");
    $this_pattern = array();
    foreach ($patterns as $pattern) {
        if (stripos($product->name, $pattern) !== false || stripos($product->description, $pattern) !== false || stripos($product->work_type, $pattern) !== false) {
            array_push($this_pattern, $pattern);
        }
    }
    if (count($this_pattern) > 0) {
        $data[] = implode("::", $this_pattern);
    } else {
        $data[] = "Other";
    }
    $c = 0;
    $solrProduct = SolrSearch::getProductsForIDs(array($product->id), $c);
    $data[] = str_replace('large', 'thickbox', $solrProduct[0]['image_link_large']);
    $c = 2;
    foreach ($solrProduct[0]['image_links'] as $oImage) {
        if ($oImage !== $solrProduct[0]['image_link_large']) {
            $data[] = str_replace('large', 'thickbox', $oImage);
            $c++;
            if ($c == 6) {
                break;
            }
        }
    }
    $cdata .= tocsv($data) . "\n";
}
echo $cdata = str_replace("\r", "", $cdata);
exit;
Exemplo n.º 3
0
} elseif (Tools::getValue('getPartnerProducts')) {
    ini_set('max_execution_time', 600);
    ini_set('memory_limit', '-1');
    header("Cache-Control: no-store, no-cache");
    header('Content-Encoding: UTF-8');
    header('Content-type: text/csv; charset=UTF-8');
    header('Content-Disposition: attachment; filename="indusdiva-products.csv"');
    //echo "\xEF\xBB\xBF"; // UTF-8 BOM
    $outstream = fopen("php://output", 'w');
    $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("SELECT p.id_product\n            from ps_product p\n            inner join ps_category_product cp on cp.id_product = p.id_product \n            where p.active = 1\n            and p.quantity > 0\n            and cp.id_category = 2");
    $header = array('SKU', 'Title', 'Link', 'Price', 'Delivery Time', 'Standard Product ID', 'Category', 'Description', 'Image', 'List Price', 'Keywords1', 'Target Gender', 'PriceIN', 'MRPIN', 'Color', 'Fabric', 'Quantity', 'Garment Type', 'Work Type', 'Blouse Length', 'Saree Length', 'Saree Width', 'weight');
    fputcsv($outstream, $header, ',', '"');
    foreach ($res as $row) {
        $productDetails = array();
        $id_product = (int) $row['id_product'];
        $productDetails = SolrSearch::getProductsForIDs(array($id_product));
        $productDetails = $productDetails[0];
        $offer_price_in = $productDetails['offer_price_in'];
        $offer_price_in_rs = $productDetails['offer_price_in_rs'];
        $mrp_in = $productDetails['mrp_in'];
        $mrp_in_rs = Tools::convertPrice($mrp_in, 4);
        $color = '';
        $colors = $productDetails['color'];
        if (isset($colors[0])) {
            $color = implode(',', $colors);
        }
        $fabric = '';
        $fabric = $productDetails['fabric'];
        $productDetails['cat_name'] = array_diff($productDetails['cat_name'], array('Home'));
        $tags = implode(',', $productDetails['cat_name']);
        $workType = implode(',', $productDetails['work_type']);
Exemplo n.º 4
0
 public function process()
 {
     $productsViewed = (isset(self::$cookie->viewed) and !empty(self::$cookie->viewed)) ? array_slice(explode(',', self::$cookie->viewed), 0, 12) : array();
     //$productsViewed = array(3866, 4553, 2338);
     global $cart;
     if ($cart->id_address_delivery) {
         $address = new Address($cart->id_address_delivery);
         if ($address->id_country) {
             $id_country = $address->id_country;
         } elseif (isset($cookie->id_country)) {
             $id_country = (int) $cookie->id_country;
         }
     } else {
         $id_country = self::$cookie->id_country;
     }
     self::$smarty->assign('price_tax_country', $id_country);
     if (sizeof($productsViewed)) {
         $total_found = 0;
         try {
             $recentlyViewed = SolrSearch::getProductsForIDs($productsViewed, $total_found, 1, 12);
             self::$smarty->assign('recently_viewed', $recentlyViewed);
         } catch (Exception $e) {
         }
     }
 }
Exemplo n.º 5
0
function getProductInformation($pid, $utm_s, $utm_m, $utm_c, $size = 'list')
{
    $info = array();
    if (isset($pid) && !empty($pid)) {
        global $link;
        $temp = 0;
        $product = SolrSearch::getProductsForIDs(array($pid), $temp);
        $product = $product[0];
        $info['name'] = strtoupper((string) $product["name"]);
        $info['description'] = (string) $product['description'];
        $info['price'] = round($product["mrp"]);
        $info['sprice'] = round($product["offer_price"]);
        $info['url'] = buildURL((string) $product["product_link"], $utm_s, $utm_m, $utm_c);
        $info['image'] = (string) $product["image_link_{$size}"];
        //echo "<pre>"; print_r( $info ); exit;
    }
    return $info;
}
Exemplo n.º 6
0
<html>
<head>
	<title>Indusdiva-Sudarshan BLR0002 products list</title>
</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 {
Exemplo n.º 7
0
 protected function getProductInformation($pid, $size = 'list')
 {
     $link = new Link();
     $product = new Product($pid, true, 1);
     $temp = 0;
     $product = SolrSearch::getProductsForIDs(array($pid), $temp);
     $product = $product[0];
     //echo "<pre>"; print_r( $product ); exit;
     $info = array();
     $info['name'] = strtoupper((string) $product["name"]);
     $info['description'] = (string) $product['description'];
     $info['price'] = round($product["mrp"]);
     $info['sprice'] = round($product["offer_price"]);
     $info['url'] = $this->buildURL((string) $product["product_link"]);
     $info['image'] = (string) $product["image_link_{$size}"];
     //echo "<pre>"; print_r( $info ); exit;
     return $info;
 }