Commit f498618c by halweg

fix

parent bf54c030
......@@ -114,8 +114,8 @@ class Main extends Generic implements TabInterface
'name' => 'sizechart_info',
'label' => __('Size Chart Information'),
'wysiwyg' => true,
'config' => $this->_wysiwygConfig->getConfig(),
'required' => true
'required' => true,
'config' => $wysiwygConfig
]
);
......@@ -154,6 +154,18 @@ class Main extends Generic implements TabInterface
);
$fieldset->addField(
'category',
'text',
[
'name' => 'category',
'label' => __('分类ID(多个用,隔开不要空格)'),
'id' => 'category',
'title' => __('分类ID(多个用,隔开不要空格)'),
'required' => false,
]
);
$fieldset->addField(
'type_display',
'hidden',
[
......
......@@ -34,7 +34,7 @@ class Tabs extends WidgetTabs
)->toHtml(),
]
);
$this->addTab(
/* $this->addTab(
'category',
[
'label' => __('Condition apply for products'),
......@@ -43,7 +43,7 @@ class Tabs extends WidgetTabs
'Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab\Condition'
)->toHtml(),
]
);
);*/
return parent::_beforeToHtml();
}
......
......@@ -68,19 +68,30 @@ class Sizechart extends \Magento\Catalog\Block\Product\AbstractProduct
$product = $this->getProduct();
$sizeChart = '';
foreach ($collection as $item) {
$config = $item->getConditionsSerialized();
$data = $this->json->unserialize($config);
$parameters = $data['parameters'];
$rule = $this->getRule($parameters);
$validate = $rule->getConditions()->validate($product);
if ($validate) {
//$config = $item->getConditionsSerialized();
//$data = $this->json->unserialize($config);
//$parameters = $data['parameters'];
//$rule = $this->getRule($parameters);
//$validate = $rule->getConditions()->validate($product);
/* if ($validate) {
$sizeChart = $item;
break;
}*/
$category = $item->getCategory();
if (empty($category)) {
continue;
}
}
$categoryIds = explode(',',$category);
$pids = $product->getCategoryIds();
if (count(array_intersect($categoryIds, $pids)) > 0 ) {
$sizeChart = $item;
break;
}
}
$this->setData('size_chart', $sizeChart);
}
return $this->getData('size_chart');
}
......
......@@ -38,10 +38,6 @@ class Save extends \Magento\Backend\App\Action
return $resultRedirect->setPath('*/*/');
}
if (isset($data['category'])) {
$data['category'] = implode(',', $data['category']);
}
$data['conditions_serialized'] = $this->serialize(['parameters' => $data['parameters']]);
if (isset($data['custom_size'])) {
......
......@@ -213,6 +213,8 @@ define([
// option's json config
jsonConfig: {},
sizeChartData : {},
// swatch's json config
jsonSwatchConfig: {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment