本文整理汇总了PHP中Product::getProductCategoriesFull方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getProductCategoriesFull方法的具体用法?PHP Product::getProductCategoriesFull怎么用?PHP Product::getProductCategoriesFull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::getProductCategoriesFull方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBreadCrumbs
private function getBreadCrumbs($product)
{
if (!method_exists('Product', 'getProductCategoriesFull')) {
return '';
}
$result = array();
$lang_id;
if (isset($this->context)) {
$lang_id = (int) $this->context->language->id;
} else {
global $cookie;
$lang_id = (int) $cookie->id_lang;
}
$all_product_subs = Product::getProductCategoriesFull((int) $product->id, (int) $lang_id);
if (isset($all_product_subs) && count($all_product_subs) > 0) {
foreach ($all_product_subs as $subcat) {
$sub_category = new Category((int) $subcat['id_category'], (int) $lang_id);
$sub_category_path = $sub_category->getParentsCategories();
foreach ($sub_category_path as $key) {
$result[] = $key['name'];
}
}
}
return implode(';', $result);
}
示例2: generateProductsData
protected function generateProductsData()
{
$delimiter = ';';
$titles = array();
$id_lang = $this->use_lang;
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/products.vsc', 'w');
foreach ($this->product_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$products = Product::getProducts($id_lang, 0, 0, 'id_product', 'ASC', false, true);
foreach ($products as $product) {
$line = array();
$p = new Product($product['id_product'], true, $id_lang, 1);
foreach ($this->product_fields as $field => $array) {
$line[$field] = property_exists('Product', $field) && !is_array($p->{$field}) && !Tools::isEmpty($p->{$field}) ? $p->{$field} : '';
}
$cats = $p->getProductCategoriesFull($p->id, 1);
$cat_array = array();
foreach ($cats as $cat) {
$cat_array[] = $cat['id_category'];
}
$line['categories'] = implode(',', $cat_array);
$line['price_tex'] = $p->getPrice(false);
$line['price_tin'] = $p->getPrice(true);
$line['upc'] = $p->upc ? $p->upc : '';
$line['features'] = '';
$features = $p->getFrontFeatures($id_lang);
$position = 1;
$devider = '';
foreach ($features as $feature) {
$sql = 'SELECT `id_feature`
FROM ' . _DB_PREFIX_ . 'feature_lang
WHERE `name` = "' . pSql($feature['name']) . '"';
$sql1 = 'SELECT `id_feature_value`
FROM ' . _DB_PREFIX_ . 'feature_value_lang
WHERE `value` = "' . pSql($feature['value']) . '"';
$id_feature = Db::getInstance()->getValue($sql);
$id_feature_value = Db::getInstance()->getValue($sql1);
$line['features'] .= $devider . $id_feature . ':' . $id_feature_value . ':' . $position;
$devider = ',';
$position++;
}
$specificPrice = SpecificPrice::getSpecificPrice($p->id, 1, 0, 0, 0, 0);
$line['reduction_price'] = '';
$line['reduction_percent'] = '';
$line['reduction_from'] = '';
$line['reduction_to'] = '';
if ($specificPrice) {
if ($specificPrice['reduction_type'] == 'amount') {
$line['reduction_price'] = $specificPrice['reduction'];
} elseif ($specificPrice['reduction_type'] == 'percent') {
$line['reduction_percent'] = $specificPrice['reduction'];
}
if ($line['reduction_price'] !== '' || $line['reduction_percent'] !== '') {
$line['reduction_from'] = $specificPrice['from'];
$line['reduction_to'] = $specificPrice['to'];
}
}
$tags = $p->getTags($id_lang);
$line['tags'] = $tags;
$link = new Link();
$imagelinks = array();
$images = $p->getImages($id_lang);
foreach ($images as $image) {
$imagelink = Tools::getShopProtocol() . $link->getImageLink($p->link_rewrite, $p->id . '-' . $image['id_image']);
$this->copyConverFileName($imagelink);
$imagelinks[] = $imagelink;
}
$line['image'] = implode(',', $imagelinks);
$line['delete_existing_images'] = 0;
$line['shop'] = 1;
$warehouses = Warehouse::getWarehousesByProductId($p->id);
$line['warehouse'] = '';
if (!empty($warehouses)) {
$line['warehouse'] = implode(',', array_map("{$this->getWarehouses}", $warehouses));
}
$values = array();
$accesories = $p->getAccessories($id_lang);
if (isset($accesories) && $accesories && count($accesories)) {
foreach ($accesories as $accesorie) {
$values[] = $accesorie['id_product'];
}
}
$line['accessories'] = $values ? implode(',', $values) : '';
$values = array();
$carriers = $p->getCarriers();
if (isset($carriers) && $carriers && count($carriers)) {
foreach ($carriers as $carrier) {
$values[] = $carrier['id_carrier'];
}
}
$line['carriers'] = $values ? implode(',', $values) : '';
$values = array();
$customization_fields_ids = $p->getCustomizationFieldIds();
if (class_exists('CustomizationField') && isset($customization_fields_ids) && $customization_fields_ids && count($customization_fields_ids)) {
foreach ($customization_fields_ids as $customization_field_id) {
$cf = new CustomizationField($customization_field_id['id_customization_field'], $this->use_lang);
$values[] = $cf->id . ':' . $cf->type . ':' . $cf->required . ':' . $cf->name;
//.........这里部分代码省略.........
示例3: displayFormInformations
//.........这里部分代码省略.........
</script>
<tr>
<td class="col-left">' . $this->l('When out of stock:') . '</td>
<td style="padding-bottom:5px;">
<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" ' . ((int) $this->getFieldValue($obj, 'out_of_stock') == 0 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_1" class="t" id="label_out_of_stock_1">' . $this->l('Deny orders') . '</label>
<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" ' . ($this->getFieldValue($obj, 'out_of_stock') == 1 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_2" class="t" id="label_out_of_stock_2">' . $this->l('Allow orders') . '</label>
<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" ' . ($this->getFieldValue($obj, 'out_of_stock') == 2 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_3" class="t" id="label_out_of_stock_3">' . $this->l('Default:') . ' <i>' . $this->l((int) Configuration::get('PS_ORDER_OUT_OF_STOCK') ? 'Allow orders' : 'Deny orders') . '</i> (' . $this->l('as set in') . ' <a href="index.php?tab=AdminPPreferences&token=' . Tools::getAdminToken('AdminPPreferences' . (int) Tab::getIdFromClassName('AdminPPreferences') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');">' . $this->l('Preferences') . '</a>)</label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-bottom:5px;">
<hr style="width:100%;" />
</td>
</tr>
<tr>
<td class="col-left"><label for="id_category_default" class="t">' . $this->l('Default category:') . '</label></td>
<td>
<div id="no_default_category" style="color: red;font-weight: bold;display: none;">' . $this->l('Please check a category in order to select the default category.') . '</div>
<script type="text/javascript">
var post_selected_cat;
</script>';
$default_category = Tools::getValue('id_category', 1);
if (!$obj->id) {
$selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
echo '
<script type="text/javascript">
post_selected_cat = \'' . implode(',', array_keys($selectedCat)) . '\';
</script>';
} else {
if (Tools::isSubmit('categoryBox')) {
$selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
} else {
$selectedCat = Product::getProductCategoriesFull($obj->id, $this->_defaultFormLanguage);
}
}
echo '<select id="id_category_default" name="id_category_default">';
foreach ($selectedCat as $cat) {
echo '<option value="' . $cat['id_category'] . '" ' . ($obj->id_category_default == $cat['id_category'] ? 'selected' : '') . '>' . $cat['name'] . '</option>';
}
echo '</select>
</td>
</tr>
<tr id="tr_categories">
<td colspan="2">
';
// Translations are not automatic for the moment ;)
$trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'));
echo Helper::renderAdminCategorieTree($trads, $selectedCat) . '
</td>
</tr>
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
<tr><td colspan="2">
<span onclick="$(\'#seo\').slideToggle();" style="cursor: pointer"><img src="../img/admin/arrow.gif" alt="' . $this->l('SEO') . '" title="' . $this->l('SEO') . '" style="float:left; margin-right:5px;"/>' . $this->l('Click here to improve product\'s rank in search engines (SEO)') . '</span><br />
<div id="seo" style="display: none; padding-top: 15px;">
<table>
<tr>
<td class="col-left">' . $this->l('Meta title:') . '</td>
<td class="translatable">';
foreach ($this->_languages as $language) {
echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<input size="55" type="text" id="meta_title_' . $language['id_lang'] . '" name="meta_title_' . $language['id_lang'] . '"
value="' . htmlentities($this->getFieldValue($obj, 'meta_title', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span>
</div>';
}
示例4: content_546105797ea627_61357006
//.........这里部分代码省略.........
?>
<div class="pack_content">
<?php
echo $_smarty_tpl->tpl_vars['packItem']->value['pack_quantity'];
?>
x <a href="<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getProductLink($_smarty_tpl->tpl_vars['packItem']->value['id_product'], $_smarty_tpl->tpl_vars['packItem']->value['link_rewrite'], $_smarty_tpl->tpl_vars['packItem']->value['category']), ENT_QUOTES, 'UTF-8', true);
?>
"><?php
echo smarty_modifier_escape($_smarty_tpl->tpl_vars['packItem']->value['name'], 'htmlall', 'UTF-8');
?>
</a>
<p><?php
echo $_smarty_tpl->tpl_vars['packItem']->value['description_short'];
?>
</p>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
}
?>
<ul class="productcats">
<?php
$_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable();
$_smarty_tpl->tpl_vars['cat']->_loop = false;
$_from = Product::getProductCategoriesFull(Tools::getValue('id_product'));
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value) {
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>
<?php
if ($_smarty_tpl->tpl_vars['cat']->value['id_category'] != 2) {
?>
<li><a href="<?php
ob_start();
echo $_smarty_tpl->tpl_vars['cat']->value['id_category'];
$_tmp2 = ob_get_clean();
echo $_smarty_tpl->tpl_vars['link']->value->getCategoryLink($_tmp2);
?>
" title="<?php
echo $_smarty_tpl->tpl_vars['cat']->value['name'];
?>
"><?php
echo $_smarty_tpl->tpl_vars['cat']->value['name'];
?>
</a></li>
<?php
}
?>
<?php
}
?>
</ul>
<?php
$_smarty_tpl->tpl_vars['pocet_hodnoceni'] = new Smarty_variable(Product::pocetHeurekaHvezd($_smarty_tpl->tpl_vars['product']->value->id, 'pocet_hodnoceni'), null, 0);
?>
示例5: initContentForAssociations
public function initContentForAssociations()
{
$vwvooilwtfmt = "sql";
${"GLOBALS"}["cgrvkkbvma"] = "root";
${"GLOBALS"}["lsrhvhqjf"] = "selected_cat";
${"GLOBALS"}["lknocboq"] = "helper";
${${"GLOBALS"}["cgrvkkbvma"]} = Category::getRootCategory();
$szksmz = "selected_cat";
$ifaquczty = "category_tree";
${"GLOBALS"}["ptiwphji"] = "category_tree";
${"GLOBALS"}["veloultyacp"] = "default_category";
${$vwvooilwtfmt} = "SELECT id_category_default FROM " . _DB_PREFIX_ . "product WHERE id_product=" . intval($this->object->id);
${${"GLOBALS"}["njpsstddwx"]} = intval(Db::getInstance()->getValue(${${"GLOBALS"}["vvskebgpewm"]}));
${"GLOBALS"}["nqufiynxn"] = "category_tree";
if (!$this->object->id) {
${${"GLOBALS"}["rnirxjg"]} = Category::getCategoryInformations(Tools::getValue("categoryBox", array(${${"GLOBALS"}["veloultyacp"]})), $this->id_language);
} else {
if (Tools::isSubmit("categoryBox")) {
${${"GLOBALS"}["rnirxjg"]} = Category::getCategoryInformations(Tools::getValue("categoryBox", array(${${"GLOBALS"}["njpsstddwx"]})), $this->id_language);
} else {
${${"GLOBALS"}["rnirxjg"]} = Product::getProductCategoriesFull($this->object->id, $this->id_language);
}
}
${"GLOBALS"}["mwlyyqxnvr"] = "selected_cat";
if (!array_key_exists(${${"GLOBALS"}["njpsstddwx"]}, ${$szksmz})) {
${"GLOBALS"}["veixrgsr"] = "default_category";
${"GLOBALS"}["rjxpfcwol"] = "sql";
$epyobpqsn = "selected_cat";
${${"GLOBALS"}["rjxpfcwol"]} = "SELECT id_category, name, link_rewrite, id_lang FROM " . _DB_PREFIX_ . "category_lang WHERE id_category=" . ${${"GLOBALS"}["veixrgsr"]} . " AND id_lang=" . intval($this->id_language);
$tvjsbnwmt = "default_category";
${$epyobpqsn}[${$tvjsbnwmt}] = Db::getInstance()->getRow(${${"GLOBALS"}["vvskebgpewm"]});
}
self::$smarty->assign("feature_shop_active", Shop::isFeatureActive());
${${"GLOBALS"}["vppwhfouit"]} = new HelperForm();
if ($this->object && $this->object->id) {
$helper->id = $this->object->id;
} else {
$helper->id = null;
}
$helper->table = "product";
$helper->identifier = "id_product";
self::$smarty->assign("displayAssoShop", $helper->renderAssoShop());
${${"GLOBALS"}["doeaqcaombq"]} = Product::getAccessoriesLight($this->id_language, $this->object->id);
if (${${"GLOBALS"}["yfkrfqnu"]} = Tools::getValue("inputAccessories")) {
${${"GLOBALS"}["qmhlnpccscr"]} = explode("-", Tools::getValue("inputAccessories"));
foreach (${${"GLOBALS"}["qmhlnpccscr"]} as ${${"GLOBALS"}["vertwbyora"]}) {
$uypybcj = "accessory";
${"GLOBALS"}["wuwogouethxi"] = "accessory_id";
${"GLOBALS"}["mkrmryb"] = "accessory";
$rukqokdbuw = "accessories";
if (!$this->haveThisAccessory(${${"GLOBALS"}["wuwogouethxi"]}, ${${"GLOBALS"}["doeaqcaombq"]}) && (${${"GLOBALS"}["mkrmryb"]} = Product::getAccessoryById(${${"GLOBALS"}["vertwbyora"]}))) {
${$rukqokdbuw}[] = ${$uypybcj};
}
}
}
self::$smarty->assign("accessories", ${${"GLOBALS"}["doeaqcaombq"]});
${${"GLOBALS"}["vbwuxas"]} = array("id_category" => $root->id, "name" => $root->name);
${${"GLOBALS"}["lknocboq"]} = new Helper();
${${"GLOBALS"}["bfswydsx"]} = AgileMultipleSeller::getSpecialCatrgoryIdsArray();
${${"GLOBALS"}["nqufiynxn"]} = $helper->renderCategoryTree(${${"GLOBALS"}["vbwuxas"]}, ${${"GLOBALS"}["mwlyyqxnvr"]}, "categoryBox", false, true, ${${"GLOBALS"}["bfswydsx"]});
${${"GLOBALS"}["ptiwphji"]} = ${${"GLOBALS"}["dwiitcql"]} . "\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\$(document).ready(function(){\n\t\t\t\tbuildTreeView();\n\t\t\t});</script>\n\t\t\t";
self::$smarty->assign(array("default_category" => ${${"GLOBALS"}["njpsstddwx"]}, "selected_cat_ids" => implode(",", array_keys(${${"GLOBALS"}["lsrhvhqjf"]})), "selected_cat" => ${${"GLOBALS"}["rnirxjg"]}, "id_category_default" => $this->object->getDefaultCategory(), "category_tree" => ${$ifaquczty}, "product" => $this->object, "agile_ms_edit_category" => Configuration::get("AGILE_MS_EDIT_CATEGORY"), "link" => $this->context->link, "id_first_available_category" => AgileHelper::GetFirstAvailableCategory(), "ajx_category_url" => AgileMultipleSeller::get_agile_ajax_categories_url()));
}
示例6: indexation
public static function indexation($id_product = false, $update = false)
{
$id_lang = Cmsearch::getLangId();
$convermax = new ConvermaxAPI();
if (!$id_product) {
if (!$convermax->batchStart()) {
return false;
}
}
$start = 0;
while ($products = Cmsearch::getProductsToIndex($id_lang, $start, 200, $id_product)) {
$start = $start + 200;
if (count($products) == 0) {
break;
}
$products_array = array();
$products_count = count($products);
for ($i = 0; $i < $products_count; $i++) {
if ($products[$i]['features']) {
foreach ($products[$i]['features'] as $feature) {
$f_name = 'f_' . $convermax->sanitize($feature['name']);
$products[$i][$f_name][] = $feature['value'];
}
unset($products[$i]['features']);
}
foreach ($products[$i] as $key => $val) {
if (is_array($val)) {
foreach ($val as $k => $v) {
if (is_array($v)) {
unset($products[$i][$key]);
}
}
}
}
$img_id = Product::getCover($products[$i]['id_product']);
$link = new Link();
$img_link = $link->getImageLink($products[$i]['link_rewrite'], $img_id['id_image'], ImageType::getFormatedName('small'));
$products[$i]['img_link'] = str_replace(Tools::getHttpHost(), '', $img_link);
$products[$i]['link'] = str_replace(Tools::getHttpHost(true), '', $products[$i]['link']);
$cat_full = Product::getProductCategoriesFull($products[$i]['id_product']);
$category_full = array();
$home_category = Configuration::get('PS_HOME_CATEGORY');
foreach ($cat_full as $cat) {
$category = new Category($cat['id_category']);
$categories = $category->getParentsCategories();
$c_full = array();
foreach ($categories as $cats) {
if ($cats['id_category'] != $home_category) {
$c_full[] = $cats['name'];
}
}
if (!empty($c_full)) {
$category_full[] = implode('>', array_reverse($c_full));
}
}
$products[$i]['category_full'] = $category_full;
$attributes = Product::getAttributesInformationsByProduct($products[$i]['id_product']);
if (!empty($attributes)) {
foreach ($attributes as $attribute) {
$a_name = 'a_' . $convermax->sanitize($attribute['group']);
$products[$i][$a_name][] = $attribute['attribute'];
}
}
if (!in_array($products[$i]['id_product'], $products_array)) {
$products_array[] = (int) $products[$i]['id_product'];
}
}
if ($update) {
if (!$convermax->update($products)) {
return false;
}
} elseif ($id_product) {
if (!$convermax->add($products)) {
return false;
}
} elseif (!$convermax->batchAdd($products)) {
return false;
}
if ($id_product) {
break;
}
}
if (!$id_product) {
if (!$convermax->batchEnd()) {
return false;
}
}
return true;
}
示例7: foreach
}
echo Helper::renderAdminCategorieTree($trads, $categoryBox, 'categoryBox', false, 'Tree');
?>
<a href="index.php?rule=category_edit" class="btn btn-link bt-icon confirm_leave">
<span class="glyphicon glyphicon-plus"></span> 创建一个新分类 <span class="glyphicon glyphicon-new-window"></span>
</a>
</div>
</div>
<?php
if (!isset($obj)) {
$selectedCat = Category::getCategoryInformations(Tools::getRequest('categoryBox'));
} else {
if (Tools::isSubmit('categoryBox')) {
$selectedCat = Category::getCategoryInformations(Tools::getRequest('categoryBox'));
} else {
$selectedCat = Product::getProductCategoriesFull($obj->id);
}
}
?>
<div class="form-group">
<label for="id_category_default" class="col-sm-2 control-label">默认分类</label>
<div class="col-sm-10">
<select name="id_category_default" class="form-control" id="id_category_default" <?php
if (!$selectedCat || count($selectedCat) == 0) {
echo 'style="display:none"';
}
?>
>
<?php
if (count($selectedCat) > 0) {
foreach ($selectedCat as $cat) {
示例8: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitExport')) {
$delimiter = Tools::getValue('export_delimiter');
$id_lang = Tools::getValue('export_language');
$id_shop = (int) $this->context->shop->id;
set_time_limit(0);
$fileName = 'products_' . date("Y_m_d_H_i_s") . '.csv';
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename={$fileName}");
header("Expires: 0");
header("Pragma: public");
$f = fopen('php://output', 'w');
foreach ($this->available_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$export_active = Tools::getValue('export_active') == 0 ? false : true;
$export_category = Tools::getValue('export_category') == 99999 ? false : Tools::getValue('export_category');
$products = Product::getProducts($id_lang, 0, 0, 'id_product', 'ASC', $export_category, $export_active);
foreach ($products as $product) {
$line = array();
$p = new Product($product['id_product'], true, $id_lang, $id_shop);
$p->loadStockData();
foreach ($this->available_fields as $field => $array) {
if (isset($p->{$field}) && !is_array($p->{$field})) {
$line[$field] = $p->{$field} ? $p->{$field} : ' ';
} else {
switch ($field) {
case 'categories':
$cats = $p->getProductCategoriesFull($p->id, $id_lang);
$cat_array = array();
foreach ($cats as $cat) {
$cat_array[] = $cat['name'];
}
$line['categories'] = implode(",", $cat_array);
break;
case 'price_tex':
$line['price_tex'] = $p->getPrice(false);
$line['price_tin'] = $p->getPrice(true);
break;
case 'upc':
$line['upc'] = $p->upc ? $p->upc : ' ';
break;
case 'features':
$line['features'] = '';
$features = $p->getFrontFeatures($id_lang);
$position = 1;
foreach ($features as $feature) {
$line['features'] .= $feature['name'] . ':' . $feature['value'] . ':' . $position;
$position++;
}
break;
case 'reduction_price':
$specificPrice = SpecificPrice::getSpecificPrice($p->id, $id_shop, 0, 0, 0, 0);
$line['reduction_price'] = '';
$line['reduction_percent'] = '';
$line['reduction_from'] = '';
$line['reduction_to'] = '';
if ($specificPrice['reduction_type'] == "amount") {
$line['reduction_price'] = $specificPrice['reduction'];
} elseif ($specificPrice['reduction_type'] == "percent") {
$line['reduction_percent'] = $specificPrice['reduction'];
}
if ($line['reduction_price'] !== '' || $line['reduction_percent'] !== '') {
$line['reduction_from'] = date_format(date_create($specificPrice['from']), "Y-m-d");
$line['reduction_to'] = date_format(date_create($specificPrice['to']), "Y-m-d");
}
break;
case 'tags':
$tags = $p->getTags($id_lang);
$line['tags'] = $tags;
break;
case 'image':
$link = new Link();
$imagelinks = array();
$images = $p->getImages($id_lang);
foreach ($images as $image) {
$imagelinks[] = Tools::getShopProtocol() . $link->getImageLink($p->link_rewrite, $p->id . '-' . $image['id_image']);
}
$line['image'] = implode(",", $imagelinks);
break;
case 'delete_existing_images':
$line['delete_existing_images'] = 0;
break;
case 'shop':
$line['shop'] = $id_shop;
break;
case 'warehouse':
$warehouses = Warehouse::getWarehousesByProductId($p->id);
$line['warehouse'] = '';
if (!empty($warehouses)) {
$line['warehouse'] = implode(',', array_map("{$this->getWarehouses}", $warehouses));
}
break;
case 'date_added':
$date = new DateTime($p->date_add);
$line['date_add'] = $date->format("Y-m-d");
//.........这里部分代码省略.........
示例9: get_category_names_by_product
/**
* get category names by product id
* @param integer $id product id
* @param boolean $array get categories as PHP array (TRUE), or javascript (FAlSE)
* @return string|array
*/
private function get_category_names_by_product($id, $array = true)
{
$_categories = Product::getProductCategoriesFull($id, $this->context->cookie->id_lang);
if (!is_array($_categories)) {
if ($array) {
return array();
} else {
return "[]";
}
}
if ($array) {
$categories = array();
foreach ($_categories as $category) {
$categories[] = $category['name'];
if (count($categories) == 5) {
break;
}
}
} else {
$categories = '[';
$c = 0;
foreach ($_categories as $category) {
$c++;
$categories .= '"' . $category['name'] . '",';
if ($c == 5) {
break;
}
}
$categories = rtrim($categories, ',');
$categories .= ']';
}
return $categories;
}
示例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;
}
示例11: content_54610538921054_42949662
//.........这里部分代码省略.........
<?php
$_smarty_tpl->tpl_vars['klad'] = new Smarty_Variable();
$_smarty_tpl->tpl_vars['klad']->_loop = false;
$_from = $_smarty_tpl->tpl_vars['recenze']->value['klady'];
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
foreach ($_from as $_smarty_tpl->tpl_vars['klad']->key => $_smarty_tpl->tpl_vars['klad']->value) {
$_smarty_tpl->tpl_vars['klad']->_loop = true;
?>
<?php
if ($_smarty_tpl->tpl_vars['klad']->value) {
?>
<span class="plus"><?php
echo $_smarty_tpl->tpl_vars['klad']->value;
?>
</span><br/>
<?php
}
?>
<?php
}
?>
</div>
<div class="heureka_zapory">
<?php
$_smarty_tpl->tpl_vars['zapor'] = new Smarty_Variable();
$_smarty_tpl->tpl_vars['zapor']->_loop = false;
$_from = $_smarty_tpl->tpl_vars['recenze']->value['zapory'];
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
foreach ($_from as $_smarty_tpl->tpl_vars['zapor']->key => $_smarty_tpl->tpl_vars['zapor']->value) {
$_smarty_tpl->tpl_vars['zapor']->_loop = true;
?>
<?php
if ($_smarty_tpl->tpl_vars['zapor']->value) {
?>
<span class="minus"><?php
echo $_smarty_tpl->tpl_vars['zapor']->value;
?>
</span><br/>
<?php
}
?>
<?php
}
?>
</div>
<div class="heureka_text"><?php
echo $_smarty_tpl->tpl_vars['recenze']->value['text'];
?>
</div>
</div>
<?php
}
?>
</div>
<div id="hodinky_kategorie">
<h3>Hodinky najdete v kategorii:</h3>
<ul class="productcats">
<?php
$_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable();
$_smarty_tpl->tpl_vars['cat']->_loop = false;
$_from = Product::getProductCategoriesFull(Tools::getValue('id_product'));
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value) {
$_smarty_tpl->tpl_vars['cat']->_loop = true;
?>
<?php
if ($_smarty_tpl->tpl_vars['cat']->value['id_category'] != 2) {
?>
<li><a href="<?php
ob_start();
echo $_smarty_tpl->tpl_vars['cat']->value['id_category'];
$_tmp1 = ob_get_clean();
echo $_smarty_tpl->tpl_vars['link']->value->getCategoryLink($_tmp1);
?>
" title="<?php
echo $_smarty_tpl->tpl_vars['cat']->value['name'];
?>
"><?php
echo $_smarty_tpl->tpl_vars['cat']->value['name'];
?>
(<?php
echo Category::pocetProduktuVKategorii($_smarty_tpl->tpl_vars['cat']->value['id_category']);
?>
)</a></li>
<?php
}
?>
<?php
}
?>
</ul>
</div>
</div><?php
}
开发者ID:h0n24,项目名称:leodig,代码行数:101,代码来源:cd3858dff3288c6fae7557b7c7d40c64759e076f.file.product-footer.tpl.php
示例12: ajaxGetCategories
public function ajaxGetCategories()
{
// If we have called the script with a term to search
if (Tools::isSubmit('id_product')) {
$id_product = (int) Tools::getValue('id_product');
/* Get product categories */
$categories = Product::getProductCategoriesFull($id_product, (int) $this->context->language->id);
/* If we have some we return the table content */
if (count($categories) > 0) {
$i = 0;
/* determination of the number of column in the table in function of the number of category to display */
$maxCells = count($categories) < 10 ? 1 : round(count($categories) / 10);
echo '<table style="text-align:left" class="table" width="100%">';
foreach ($categories as $category) {
if ($i == $maxCells) {
$i = 0;
}
if ($i == 0) {
echo '<tr>';
}
echo '<td>' . $category['name'] . '</td>';
if ($i == $maxCells) {
echo '</tr>';
}
$i++;
}
echo '</table>';
} else {
echo $this->l('There is no categorie');
}
}
exit;
}