提交 27ee0004 编写于 作者: T Terry

产品保存,custom option sku 含有字符 . 的bug

上级 398dc6c8
......@@ -72,26 +72,26 @@ class Manageredit extends AppadminbaseBlockEdit implements AppadminbaseBlockEdit
public function getLastData()
{
return [
'baseInfo' => $this->getBaseInfo(),
'priceInfo' => $this->getPriceInfo(),
'tier_price' => $this->_one['tier_price'],
'metaInfo' => $this->getMetaInfo(),
'groupAttr' => $this->getGroupAttr(),
'descriptionInfo' => $this->getDescriptionInfo(),
'attrGroup' => $this->_attr->getProductAttrGroupSelect(),
'primaryInfo' => $this->getCurrentProductPrimay(),
'img_html' => $this->getImgHtml(),
'custom_option' => $this->_one['custom_option'],
'product_id' => $this->_one[Yii::$service->product->getPrimaryKey()],
//'editBar' => $this->getEditBar(),
//'textareas' => $this->_textareas,
//'lang_attr' => $this->_lang_attr,
'saveUrl' => $this->_saveUrl,
'operate' => Yii::$app->request->get('operate'),
'baseInfo' => $this->getBaseInfo(),
'priceInfo' => $this->getPriceInfo(),
'tier_price' => $this->_one['tier_price'],
'metaInfo' => $this->getMetaInfo(),
'groupAttr' => $this->getGroupAttr(),
'descriptionInfo' => $this->getDescriptionInfo(),
'attrGroup' => $this->_attr->getProductAttrGroupSelect(),
'primaryInfo' => $this->getCurrentProductPrimay(),
'img_html' => $this->getImgHtml(),
'custom_option' => $this->_one['custom_option'],
'product_id' => $this->_one[Yii::$service->product->getPrimaryKey()],
//'editBar' => $this->getEditBar(),
//'textareas' => $this->_textareas,
//'lang_attr' => $this->_lang_attr,
'saveUrl' => $this->_saveUrl,
'operate' => Yii::$app->request->get('operate'),
'custom_option_add' => $this->getCustomOptionAdd(),
'custom_option_img' => $this->getCustomOpImgHtml(),
'custom_option_list' => $this->_custom_option_list_str,
'relation' => $this->getRelationInfo(),
'custom_option_list'=> $this->_custom_option_list_str,
'relation' => $this->getRelationInfo(),
];
}
......
......@@ -342,7 +342,7 @@ class ProductMongodb implements ProductInterface
* 对保存的数据进行数据验证
* sku spu 默认语言name , 默认语言description不能为空。
*/
protected function initSave($one)
protected function initSave(&$one)
{
if (!isset($one['sku']) || empty($one['sku'])) {
Yii::$service->helper->errors->add(' sku 必须存在 ');
......@@ -366,6 +366,14 @@ class ProductMongodb implements ProductInterface
return false;
}
if (is_array($one['custom_option']) && !empty($one['custom_option'])) {
$new_custom_option = [];
foreach ($one['custom_option'] as $k=>$v) {
$k = preg_replace('/[^A-Za-z0-9\-_]/', '', $k);
$new_custom_option[$k] = $v;
}
$one['custom_option'] = $new_custom_option;
}
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册