Commit f498618c by halweg

fix

parent bf54c030
...@@ -114,8 +114,8 @@ class Main extends Generic implements TabInterface ...@@ -114,8 +114,8 @@ class Main extends Generic implements TabInterface
'name' => 'sizechart_info', 'name' => 'sizechart_info',
'label' => __('Size Chart Information'), 'label' => __('Size Chart Information'),
'wysiwyg' => true, 'wysiwyg' => true,
'config' => $this->_wysiwygConfig->getConfig(), 'required' => true,
'required' => true 'config' => $wysiwygConfig
] ]
); );
...@@ -154,6 +154,18 @@ class Main extends Generic implements TabInterface ...@@ -154,6 +154,18 @@ class Main extends Generic implements TabInterface
); );
$fieldset->addField( $fieldset->addField(
'category',
'text',
[
'name' => 'category',
'label' => __('分类ID(多个用,隔开不要空格)'),
'id' => 'category',
'title' => __('分类ID(多个用,隔开不要空格)'),
'required' => false,
]
);
$fieldset->addField(
'type_display', 'type_display',
'hidden', 'hidden',
[ [
......
...@@ -34,7 +34,7 @@ class Tabs extends WidgetTabs ...@@ -34,7 +34,7 @@ class Tabs extends WidgetTabs
)->toHtml(), )->toHtml(),
] ]
); );
$this->addTab( /* $this->addTab(
'category', 'category',
[ [
'label' => __('Condition apply for products'), 'label' => __('Condition apply for products'),
...@@ -43,7 +43,7 @@ class Tabs extends WidgetTabs ...@@ -43,7 +43,7 @@ class Tabs extends WidgetTabs
'Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab\Condition' 'Magepow\Sizechart\Block\Adminhtml\Sizechart\Edit\Tab\Condition'
)->toHtml(), )->toHtml(),
] ]
); );*/
return parent::_beforeToHtml(); return parent::_beforeToHtml();
} }
......
...@@ -68,19 +68,30 @@ class Sizechart extends \Magento\Catalog\Block\Product\AbstractProduct ...@@ -68,19 +68,30 @@ class Sizechart extends \Magento\Catalog\Block\Product\AbstractProduct
$product = $this->getProduct(); $product = $this->getProduct();
$sizeChart = ''; $sizeChart = '';
foreach ($collection as $item) { foreach ($collection as $item) {
$config = $item->getConditionsSerialized(); //$config = $item->getConditionsSerialized();
$data = $this->json->unserialize($config); //$data = $this->json->unserialize($config);
$parameters = $data['parameters']; //$parameters = $data['parameters'];
$rule = $this->getRule($parameters); //$rule = $this->getRule($parameters);
$validate = $rule->getConditions()->validate($product); //$validate = $rule->getConditions()->validate($product);
if ($validate) { /* if ($validate) {
$sizeChart = $item; $sizeChart = $item;
break; 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); $this->setData('size_chart', $sizeChart);
} }
return $this->getData('size_chart'); return $this->getData('size_chart');
} }
......
...@@ -38,10 +38,6 @@ class Save extends \Magento\Backend\App\Action ...@@ -38,10 +38,6 @@ class Save extends \Magento\Backend\App\Action
return $resultRedirect->setPath('*/*/'); return $resultRedirect->setPath('*/*/');
} }
if (isset($data['category'])) {
$data['category'] = implode(',', $data['category']);
}
$data['conditions_serialized'] = $this->serialize(['parameters' => $data['parameters']]); $data['conditions_serialized'] = $this->serialize(['parameters' => $data['parameters']]);
if (isset($data['custom_size'])) { if (isset($data['custom_size'])) {
......
...@@ -213,6 +213,8 @@ define([ ...@@ -213,6 +213,8 @@ define([
// option's json config // option's json config
jsonConfig: {}, jsonConfig: {},
sizeChartData : {},
// swatch's json config // swatch's json config
jsonSwatchConfig: {}, 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