当前位置: 首页>>代码示例>>PHP>>正文


PHP Product::getAttributeCombinaisons方法代码示例

本文整理汇总了PHP中Product::getAttributeCombinaisons方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getAttributeCombinaisons方法的具体用法?PHP Product::getAttributeCombinaisons怎么用?PHP Product::getAttributeCombinaisons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Product的用法示例。


在下文中一共展示了Product::getAttributeCombinaisons方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: viewsupplier

    public function viewsupplier()
    {
        global $cookie;
        $supplier = $this->loadObject();
        echo '<h2>' . $supplier->name . '</h2>';
        $products = $supplier->getProductsLite(intval($cookie->id_lang));
        echo '<h3>' . $this->l('Total products:') . ' ' . sizeof($products) . '</h3>';
        foreach ($products as $product) {
            $product = new Product($product['id_product'], false, intval($cookie->id_lang));
            echo '<hr />';
            if (!$product->hasAttributes()) {
                echo '
				<table border="0" cellpadding="0" cellspacing="0" class="table width3">
					<tr>
						<th><a href="index.php?tab=AdminCatalog&id_product=' . $product->id . '&addproduct&token=' . Tools::getAdminToken('AdminCatalog' . intval(Tab::getIdFromClassName('AdminCatalog')) . intval($cookie->id_employee)) . '" target="_blank">' . $product->name . '</a></th>
						' . (!empty($product->reference) ? '<th width="150">' . $this->l('Ref:') . ' ' . $product->reference . '</th>' : '') . '
						' . (!empty($product->ean13) ? '<th width="120">' . $this->l('EAN13:') . ' ' . $product->ean13 . '</th>' : '') . '
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="50">' . $this->l('Qty:') . ' ' . $product->quantity . '</th>' : '') . '
					</tr>
				</table>';
            } else {
                echo '
				<h3><a href="index.php?tab=AdminCatalog&id_product=' . $product->id . '&addproduct&token=' . Tools::getAdminToken('AdminCatalog' . intval(Tab::getIdFromClassName('AdminCatalog')) . intval($cookie->id_employee)) . '" target="_blank">' . $product->name . '</a></h3>
				<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
	                	<tr>
		                    <th>' . $this->l('Attribute name') . '</th>
		                    <th width="80">' . $this->l('Reference') . '</th>
		                    <th width="80">' . $this->l('EAN13') . '</th>
		                   ' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">' . $this->l('Quantity') . '</th>' : '') . '
	                	</tr>';
                /* Build attributes combinaisons */
                $combinaisons = $product->getAttributeCombinaisons(intval($cookie->id_lang));
                foreach ($combinaisons as $k => $combinaison) {
                    $combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
                    $combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
                    $combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
                    $combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
                }
                $irow = 0;
                foreach ($combArray as $id_product_attribute => $product_attribute) {
                    $list = '';
                    foreach ($product_attribute['attributes'] as $attribute) {
                        $list .= $attribute[0] . ' - ' . $attribute[1] . ', ';
                    }
                    $list = rtrim($list, ', ');
                    echo '
					<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . ' >
						<td>' . stripslashes($list) . '</td>
						<td>' . $product_attribute['reference'] . '</td>
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<td>' . $product_attribute['ean13'] . '</td>' : '') . '
						<td class="right">' . $product_attribute['quantity'] . '</td>
					</tr>';
                }
                unset($combArray);
                echo '</table>';
                echo '</td></tr></table>';
            }
        }
    }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:59,代码来源:AdminSuppliers.php

示例2: getData

 protected function getData($layers)
 {
     global $cookie;
     if ($this->_option == 42) {
         $products = $this->getProducts(intval($cookie->id_lang));
         foreach ($products as $product) {
             $this->_values[0][] = $product['reference'];
             $this->_values[1][] = $product['name'];
             $this->_values[2][] = $product['quantity'];
             $this->_legend[] = $product['id_product'];
         }
     } elseif ($this->_option != 3) {
         $this->setDateGraph($layers, true);
     } else {
         $product = new Product($this->_id_product, false, (int) $this->getLang());
         $combArray = array();
         $assocNames = array();
         $combinaisons = $product->getAttributeCombinaisons((int) $this->getLang());
         foreach ($combinaisons as $k => $combinaison) {
             $combArray[$combinaison['id_product_attribute']][] = array('group' => $combinaison['group_name'], 'attr' => $combinaison['attribute_name']);
         }
         foreach ($combArray as $id_product_attribute => $product_attribute) {
             $list = '';
             foreach ($product_attribute as $attribute) {
                 $list .= trim($attribute['group']) . ' - ' . trim($attribute['attr']) . ', ';
             }
             $list = rtrim($list, ', ');
             $assocNames[$id_product_attribute] = $list;
         }
         $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query);
         foreach ($result as $row) {
             $this->_values[] = $row['total'];
             $this->_legend[] = @$assocNames[$row['product_attribute_id']];
         }
     }
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:36,代码来源:statsproduct.php

示例3: viewmanufacturer

    public function viewmanufacturer()
    {
        global $cookie;
        $manufacturer = $this->loadObject();
        echo '<h2>' . $manufacturer->name . '</h2>';
        $products = $manufacturer->getProductsLite(intval($cookie->id_lang));
        $addresses = $manufacturer->getAddresses(intval($cookie->id_lang));
        echo '<h3>' . $this->l('Total addresses:') . ' ' . sizeof($addresses) . '</h3>';
        echo '<hr />';
        foreach ($addresses as $addresse) {
            echo '
				<h3></h3>
				<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
					<tr>
						<th><b>' . $addresse['firstname'] . ' ' . $addresse['lastname'] . '</b></th>
					</tr>
					<tr>
						<td>
							<div style="padding:5px; float:left; width:350px;">
								' . $addresse['address1'] . '<br />
								' . ($addresse['address2'] ? $addresse['address2'] . '<br />' : '') . '
								' . $addresse['postcode'] . ' ' . $addresse['city'] . '<br />
								' . ($addresse['state'] ? $addresse['state'] . '<br />' : '') . '
								<b>' . $addresse['country'] . '</b><br />
								</div>
							<div style="padding:5px; float:left;">
								' . ($addresse['phone'] ? $addresse['phone'] . '<br />' : '') . '
								' . ($addresse['phone_mobile'] ? $addresse['phone_mobile'] . '<br />' : '') . '
							</div>
							' . ($addresse['other'] ? '<div style="padding:5px; clear:both;"><br /><i>' . $addresse['other'] . '</i></div>' : '') . '
						</td>
					</tr>
				</table>';
        }
        if (!sizeof($addresses)) {
            echo 'No address for this manufacturer.';
        }
        echo '<br /><br />';
        echo '<h3>' . $this->l('Total products:') . ' ' . sizeof($products) . '</h3>';
        foreach ($products as $product) {
            $product = new Product($product['id_product'], false, intval($cookie->id_lang));
            echo '<hr />';
            if (!$product->hasAttributes()) {
                echo '
				<table border="0" cellpadding="0" cellspacing="0" class="table width3">
					<tr>
						<th>' . $product->name . '</th>
						' . (!empty($product->reference) ? '<th width="150">' . $this->l('Ref:') . ' ' . $product->reference . '</th>' : '') . '
						' . (!empty($product->ean13) ? '<th width="120">' . $this->l('EAN13:') . ' ' . $product->ean13 . '</th>' : '') . '
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="50">' . $this->l('Qty:') . ' ' . $product->quantity . '</th>' : '') . '
					</tr>
				</table>';
            } else {
                echo '
				<h3>' . $product->name . '</h3>
				<table>
					<tr>
						<td colspan="2">
		            		<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
			                	<tr>
				                    <th>' . $this->l('Attribute name') . '</th>
				                    <th width="80">' . $this->l('Reference') . '</th>
				                    <th width="80">' . $this->l('EAN13') . '</th>
				                   ' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">' . $this->l('Quantity') . '</th>' : '') . '
			                	</tr>';
                /* Build attributes combinaisons */
                $combinaisons = $product->getAttributeCombinaisons(intval($cookie->id_lang));
                foreach ($combinaisons as $k => $combinaison) {
                    $combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
                    $combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
                    $combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
                    $combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
                }
                $irow = 0;
                foreach ($combArray as $id_product_attribute => $product_attribute) {
                    $list = '';
                    foreach ($product_attribute['attributes'] as $attribute) {
                        $list .= $attribute[0] . ' - ' . $attribute[1] . ', ';
                    }
                    $list = rtrim($list, ', ');
                    echo '
					<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . ' >
						<td>' . stripslashes($list) . '</td>
						<td>' . $product_attribute['reference'] . '</td>
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<td>' . $product_attribute['ean13'] . '</td>' : '') . '
						<td class="right">' . $product_attribute['quantity'] . '</td>
					</tr>';
                }
                unset($combArray);
                echo '</table>';
            }
        }
    }
开发者ID:sealence,项目名称:local,代码行数:93,代码来源:AdminManufacturers.php

示例4: getData

 protected function getData($layers)
 {
     if ($this->_option != 3) {
         $this->setDateGraph($layers, true);
     } else {
         $product = new Product($this->_id_product, false, intval($this->getLang()));
         $combArray = array();
         $assocNames = array();
         $combinaisons = $product->getAttributeCombinaisons(intval($this->getLang()));
         foreach ($combinaisons as $k => $combinaison) {
             $combArray[$combinaison['id_product_attribute']][] = array('group' => $combinaison['group_name'], 'attr' => $combinaison['attribute_name']);
         }
         foreach ($combArray as $id_product_attribute => $product_attribute) {
             $list = '';
             foreach ($product_attribute as $attribute) {
                 $list .= trim($attribute['group']) . ' - ' . trim($attribute['attr']) . ', ';
             }
             $list = rtrim($list, ', ');
             $assocNames[$id_product_attribute] = $list;
         }
         $result = Db::getInstance()->ExecuteS($this->_query);
         foreach ($result as $row) {
             $this->_values[] = $row['total'];
             $this->_legend[] = @$assocNames[$row['product_attribute_id']];
         }
     }
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:27,代码来源:statsproduct.php

示例5: viewmanufacturer

    public function viewmanufacturer()
    {
        global $cookie;
        if (!($manufacturer = $this->loadObject())) {
            return;
        }
        echo '<h2>' . $manufacturer->name . '</h2>';
        $products = $manufacturer->getProductsLite((int) $cookie->id_lang);
        $addresses = $manufacturer->getAddresses((int) $cookie->id_lang);
        echo '<h3>' . $this->l('Total addresses:') . ' ' . sizeof($addresses) . '</h3>';
        echo '<hr />';
        foreach ($addresses as $addresse) {
            echo '
				<h3></h3>
				<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
					<tr>
						<th><b>' . $addresse['firstname'] . ' ' . $addresse['lastname'] . '</b></th>
					</tr>
					<tr>
						<td>
							<div style="padding:5px; float:left; width:350px;">
								' . $addresse['address1'] . '<br />
								' . ($addresse['address2'] ? $addresse['address2'] . '<br />' : '') . '
								' . $addresse['postcode'] . ' ' . $addresse['city'] . '<br />
								' . ($addresse['state'] ? $addresse['state'] . '<br />' : '') . '
								<b>' . $addresse['country'] . '</b><br />
								</div>
							<div style="padding:5px; float:left;">
								' . ($addresse['phone'] ? $addresse['phone'] . '<br />' : '') . '
								' . ($addresse['phone_mobile'] ? $addresse['phone_mobile'] . '<br />' : '') . '
							</div>
							' . ($addresse['other'] ? '<div style="padding:5px; clear:both;"><br /><i>' . $addresse['other'] . '</i></div>' : '') . '
						</td>
					</tr>
				</table>';
        }
        if (!sizeof($addresses)) {
            echo 'No address for this manufacturer.';
        }
        echo '<br /><br />';
        echo '<h3>' . $this->l('Total products:') . ' ' . sizeof($products) . '</h3>';
        foreach ($products as $product) {
            $product = new Product($product['id_product'], false, (int) $cookie->id_lang);
            echo '<hr />';
            if (!$product->hasAttributes()) {
                echo '
				<div style="float:right;">
					<a href="?tab=AdminCatalog&id_product=' . $product->id . '&updateproduct&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '" class="button">' . $this->l('Edit') . '</a>
					<a href="?tab=AdminCatalog&id_product=' . $product->id . '&deleteproduct&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '" class="button" onclick="return confirm(\'' . $this->l('Delete item #', __CLASS__, TRUE) . $product->id . ' ?\');">' . $this->l('Delete') . '</a>
				</div>
				<table border="0" cellpadding="0" cellspacing="0" class="table width3">
					<tr>
						<th>' . $product->name . '</th>
						' . (!empty($product->reference) ? '<th width="150">' . $this->l('Ref:') . ' ' . $product->reference . '</th>' : '') . '
						' . (!empty($product->ean13) ? '<th width="120">' . $this->l('EAN13:') . ' ' . $product->ean13 . '</th>' : '') . '
						' . (!empty($product->upc) ? '<th width="120">' . $this->l('UPC:') . ' ' . $product->upc . '</th>' : '') . '
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="50">' . $this->l('Qty:') . ' ' . $product->quantity . '</th>' : '') . '
					</tr>
				</table>';
            } else {
                echo '
				<div style="float:right;">
					<a href="?tab=AdminCatalog&id_product=' . $product->id . '&updateproduct&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '" class="button">' . $this->l('Edit') . '</a>
					<a href="?tab=AdminCatalog&id_product=' . $product->id . '&deleteproduct&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '" class="button" onclick="return confirm(\'' . $this->l('Delete item #', __CLASS__, TRUE) . $product->id . ' ?\');">' . $this->l('Delete') . '</a>
				</div>
				<h3><a href="?tab=AdminCatalog&id_product=' . $product->id . '&updateproduct&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '">' . $product->name . '</a></h3>
				<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
					<tr>
	                    <th>' . $this->l('Attribute name') . '</th>
	                    <th width="80">' . $this->l('Reference') . '</th>
	                    <th width="80">' . $this->l('EAN13') . '</th>
						<th width="80">' . $this->l('UPC') . '</th>
	                   ' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">' . $this->l('Quantity') . '</th>' : '') . '
                	</tr>';
                /* Build attributes combinaisons */
                $combinaisons = $product->getAttributeCombinaisons((int) $cookie->id_lang);
                foreach ($combinaisons as $k => $combinaison) {
                    $combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
                    $combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
                    $combArray[$combinaison['id_product_attribute']]['upc'] = $combinaison['upc'];
                    $combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
                    $combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
                }
                $irow = 0;
                foreach ($combArray as $id_product_attribute => $product_attribute) {
                    $list = '';
                    foreach ($product_attribute['attributes'] as $attribute) {
                        $list .= $attribute[0] . ' - ' . $attribute[1] . ', ';
                    }
                    $list = rtrim($list, ', ');
                    echo '
					<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . ' >
						<td>' . stripslashes($list) . '</td>
						<td>' . $product_attribute['reference'] . '</td>
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<td>' . $product_attribute['ean13'] . '</td><td>' . $product_attribute['upc'] . '</td>' : '') . '
						<td class="right">' . $product_attribute['quantity'] . '</td>
					</tr>';
                }
                unset($combArray);
                echo '</table>';
//.........这里部分代码省略.........
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:101,代码来源:AdminManufacturers.php

示例6: getAlertCategories

 private function getAlertCategories()
 {
     $alert = '';
     $sql_getCatNonMultiSku = "SELECT * FROM " . _DB_PREFIX_ . "ebay_category_configuration AS ecc\r\n\t\t\tINNER JOIN " . _DB_PREFIX_ . "ebay_category AS ec ON ecc.id_ebay_category = ec.id_ebay_category";
     $CatNonMultiSku = Db::getInstance()->ExecuteS($sql_getCatNonMultiSku);
     $catWithProblem = array();
     foreach ($CatNonMultiSku as $cat) {
         if ($cat['is_multi_sku'] != 1 && $this->findIfCategoryParentIsMultiSku($cat['id_category_ref']) != 1) {
             $categorie = new Category($cat['id_category']);
             $products = $categorie->getProductsWs($this->id_lang, 0, 300);
             $catProblem = 0;
             foreach ($products as $productArray) {
                 $product = new Product($productArray['id']);
                 $combinations = $product->getAttributeCombinaisons($this->id_lang);
                 if (count($combinations) > 0 && $catProblem == 0) {
                     $catWithProblem[] = $cat['name'];
                     $catProblem = 1;
                 }
             }
         }
     }
     $var = '';
     $j = 0;
     foreach ($catWithProblem as $cat) {
         if ($j != 0) {
             $var .= ', ';
         }
         $var .= $cat;
         $j++;
     }
     if (count($catWithProblem) > 0) {
         if (count($catWithProblem == 1)) {
             $alert = '<b>' . $this->l('You have chosen eBay category : ') . $var . $this->l(' which does not support multivariation products. Each variation of a product will generate a new product in eBay') . '</b>';
         } else {
             $alert = '<b>' . $this->l('You have chosen eBay categories : ') . $var . $this->l(' which do not support multivariation products. Each variation of a product will generate a new product in eBay') . '</b>';
         }
     }
     return $alert;
 }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:39,代码来源:ebay.php

示例7: addProducts


//.........这里部分代码省略.........
        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)));
            }
            $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;
        $doc->cashback_percentage = $productObj->cashback_percentage;
        $docs[] = $doc;
        if (++$count == 300) {
            $update->addDocuments($docs);
            $result = $client->update($update);
            echo 'Update query executed' . PHP_EOL;
            echo 'Query status: ' . $result->getStatus() . PHP_EOL;
            echo 'Query time: ' . $result->getQueryTime() . PHP_EOL;
            $count = 0;
            $docs = array();
            $update = $client->createUpdate();
        }
    }
    $update->addDocuments($docs);
    date_default_timezone_set($default_tz);
    $result = $client->update($update);
    $sql = "update ps_product set indexed = 1 where indexed = 0";
    Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:101,代码来源:reindex2.php

示例8: getMultiVarToNonMultiSku

    public static function getMultiVarToNonMultiSku($ebay_profile, $context)
    {
        $cat_with_problem = array();
        $sql_get_cat_non_multi_sku = 'SELECT * FROM ' . _DB_PREFIX_ . 'ebay_category_configuration AS ecc
			INNER JOIN ' . _DB_PREFIX_ . 'ebay_category AS ec ON ecc.id_ebay_category = ec.id_ebay_category
			WHERE ecc.id_ebay_profile = ' . (int) $ebay_profile->id . ' GROUP BY name';
        foreach (Db::getInstance()->ExecuteS($sql_get_cat_non_multi_sku) as $cat) {
            if ($cat['is_multi_sku'] != 1 && EbayCategory::getInheritedIsMultiSku($cat['id_category_ref'], $ebay_profile->ebay_site_id) != 1) {
                $catProblem = 0;
                $category = new Category($cat['id_category']);
                $ebay_country = EbayCountrySpec::getInstanceByKey($ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT'));
                $products = $category->getProductsWs($ebay_country->getIdLang(), 0, 300);
                foreach ($products as $product_ar) {
                    $product = new Product($product_ar['id']);
                    $combinations = version_compare(_PS_VERSION_, '1.5', '>') ? $product->getAttributeCombinations($context->cookie->id_lang) : $product->getAttributeCombinaisons($context->cookie->id_lang);
                    if (count($combinations) > 0 && !$catProblem) {
                        $cat_with_problem[] = $cat['name'];
                        $catProblem = 1;
                    }
                }
            }
        }
        return $cat_with_problem;
    }
开发者ID:anantha89,项目名称:gpprestashop,代码行数:24,代码来源:EbayCategoryConfiguration.php

示例9: _getAlertCategories

    private function _getAlertCategories()
    {
        $alert = '';
        $cat_with_problem = array();
        $sql_get_cat_non_multi_sku = 'SELECT * FROM ' . _DB_PREFIX_ . 'ebay_category_configuration AS ecc
			INNER JOIN ' . _DB_PREFIX_ . 'ebay_category AS ec ON ecc.id_ebay_category = ec.id_ebay_category';
        foreach (Db::getInstance()->ExecuteS($sql_get_cat_non_multi_sku) as $cat) {
            if ($cat['is_multi_sku'] != 1 && EbayCategory::getInheritedIsMultiSku($cat['id_category_ref']) != 1) {
                $catProblem = 0;
                $category = new Category($cat['id_category']);
                $products = $category->getProductsWs($this->ebay_country->getIdLang(), 0, 300);
                foreach ($products as $product_ar) {
                    $product = new Product($product_ar['id']);
                    $combinations = version_compare(_PS_VERSION_, '1.5', '>') ? $product->getAttributeCombinations($this->context->cookie->id_lang) : $product->getAttributeCombinaisons($this->context->cookie->id_lang);
                    if (count($combinations) > 0 && !$catProblem) {
                        $cat_with_problem[] = $cat['name'];
                        $catProblem = 1;
                    }
                }
            }
        }
        $var = implode(', ', $cat_with_problem);
        if (count($cat_with_problem) > 0) {
            if (count($cat_with_problem == 1)) {
                // RAPH: pb here in the test. Potential typo
                $alert = '<b>' . $this->l('You have chosen eBay category : ') . $var . $this->l(' which does not support multivariation products. Each variation of a product will generate a new product in eBay') . '</b>';
            } else {
                $alert = '<b>' . $this->l('You have chosen eBay categories : ') . $var . $this->l(' which do not support multivariation products. Each variation of a product will generate a new product in eBay') . '</b>';
            }
        }
        return $alert;
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:32,代码来源:ebay.php

示例10: _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;
 }
开发者ID:johnulist,项目名称:Prestashop_idealo,代码行数:80,代码来源:idealo.php

示例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;
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:101,代码来源:SolrSearch.php

示例12: formatEntityToXML

 /**
  * Convert the entities data into an xml object and return the xml object as a string
  *
  * @param array $aEntity Entity data
  */
 public function formatEntityToXML($aEntity)
 {
     global $link;
     $sReturn = '';
     $dom = new DOMDocument('1.0', 'utf-8');
     $oProduct = new Product((int) $aEntity['id_product'], true);
     if ((int) $oProduct->quantity < (int) $this->productMinQuantity) {
         $this->nbEntitiesTreated--;
         $this->nbEntities--;
         return ' ';
     }
     $ps_tax = (int) Configuration::get('PS_TAX');
     foreach ($this->aLanguages as $aLanguage) {
         $id_lang = (int) $aLanguage['id_lang'];
         // Set the root of the XML
         $root = $dom->createElement($this->sEntity);
         $dom->appendChild($root);
         //$root->setAttribute('timestamp', date('c',strtotime($oProduct->date_add)));
         $root->setAttribute('timestamp', (int) strtotime($oProduct->date_add));
         $id = $dom->createElement('id', (int) $oProduct->id);
         $root->appendChild($id);
         $profile = $dom->createElement('profile', $id_lang);
         $root->appendChild($profile);
         $name = $dom->createElement('name');
         $name->appendChild($dom->createCDATASection($oProduct->name[$id_lang]));
         $root->appendChild($name);
         $oCategory = new Category((int) $oProduct->id_category_default);
         $aCategories = $oCategory->getParentsCategories($id_lang);
         if (is_array($aCategories) && count($aCategories) > 0) {
             foreach ($aCategories as $aCategory) {
                 $oCategoryTmp = new Category((int) $aCategory['id_category'], $id_lang);
                 if (!empty($oCategoryTmp->name)) {
                     $genre = $dom->createElement('genre');
                     $genre->appendChild($dom->createCDATASection($oCategoryTmp->name));
                     $root->appendChild($genre);
                 }
                 unset($oCategoryTmp);
             }
         }
         unset($aCategories);
         unset($oCategory);
         if (!empty($oProduct->ean13)) {
             $ean = $dom->createElement('ean');
             $ean->appendChild($dom->createCDATASection($oProduct->ean13));
             $root->appendChild($ean);
         }
         $price = $dom->createElement('price', number_format($oProduct->getPrice($ps_tax), 2, '.', ''));
         $root->appendChild($price);
         if (isset($oProduct->tags[$id_lang]) && ($aTags = $oProduct->tags[$id_lang])) {
             $tag = $dom->createElement('tag');
             $tag->appendChild($dom->createCDATASection(join(',', $aTags)));
             $root->appendChild($tag);
         }
         $sDesc = trim(strip_tags($oProduct->description[$id_lang]));
         if ($this->descInExport && !empty($sDesc)) {
             $description = $dom->createElement('description');
             $description->appendChild($dom->createCDATASection($sDesc));
             $root->appendChild($description);
         }
         if (!empty($oProduct->id_manufacturer)) {
             $supplierid = $dom->createElement('supplierid', (int) $oProduct->id_manufacturer);
             $root->appendChild($supplierid);
         }
         $recommendable = $dom->createElement('recommendable', in_array((int) $oProduct->id, $this->aProductsNotRecommendable) ? 'false' : 'true');
         $root->appendChild($recommendable);
         $searchable = $dom->createElement('searchable', in_array((int) $oProduct->id, $this->aProductsNotSearchable) ? 'false' : 'true');
         $root->appendChild($searchable);
         // Set product URL
         $attribute = $dom->createElement('attribute');
         $root->appendChild($attribute);
         $attName = $dom->createElement('attName', 'producturl');
         $attribute->appendChild($attName);
         $attValue = $dom->createElement('attValue');
         $attValue->appendChild($dom->createCDATASection($link->getProductLink((int) $oProduct->id, $oProduct->link_rewrite[$id_lang], Category::getLinkRewrite((int) $oProduct->id_category_default, $id_lang), NULL, $id_lang)));
         $attribute->appendChild($attValue);
         // Set product picture
         if ($this->imageInExport) {
             $attribute = $dom->createElement('attribute');
             $root->appendChild($attribute);
             $attName = $dom->createElement('attName', 'imageurl');
             $attribute->appendChild($attName);
             $aCover = $oProduct->getCover((int) $oProduct->id);
             $attValue = $dom->createElement('attValue');
             $attValue->appendChild($dom->createCDATASection($link->getImageLink($oProduct->link_rewrite[$id_lang], (int) $aCover['id_image'], 'large')));
             $attribute->appendChild($attValue);
         }
         // Set combinations
         $aProductCombinations = $oProduct->getAttributeCombinaisons($id_lang);
         if (sizeof($aProductCombinations)) {
             foreach ($aProductCombinations as $aProductCombination) {
                 if (!is_array($this->aAttributesGroupsIds) || in_array((int) $aProductCombination['id_attribute_group'], $this->aAttributesGroupsIds)) {
                     $attribute = $dom->createElement('attribute');
                     $root->appendChild($attribute);
                     $attName = $dom->createElement('attName');
                     $attName->appendChild($dom->createCDATASection($aProductCombination['group_name']));
//.........这里部分代码省略.........
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:101,代码来源:ProductExtractorToXML.php


注:本文中的Product::getAttributeCombinaisons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。