ZenCart补齐缺失的多语言SQL

时间:12-06-09 栏目:问题及解决 作者:admin 评论:0 点击: 4,419 次

ZenCart 1.38/1.39版本程序,在产品添加完成后,再添加新的语言包时,在编辑原有的产品或分类时会出现后台无法保存新添加的语言而新添加时没有问题的情况。

原因是在数据库没有对应的数据条目,而编辑原有产品时,程序只执行更新操作,所以保存不成功。

解决的办法是在多语言添加后再进行产品的添加,或者运行SQL语句把缺失的多语言内容补齐。

SQL语句可以参考下面的部分(注意前面两个语句,请根据自己网站的情况进行修改,有多个语言时,复制并修改此次多次运行。多语言的ID可以在后台Localization/Languages处点击看到,如:http://www.site.com/admin/languages.php?page=1&lID=2):

 

#设置默认语言的ID
SET @default_lang=1;
#设置新语言的ID
SET @target_lang=2;

INSERT INTO `products_description`

( products_id, language_id, products_name, products_description, products_url,products_viewed )

SELECT products_id, @target_lang AS language_id, products_name, products_description, products_url, products_viewed

FROM `products_description`

WHERE language_id =@default_lang

AND products_id NOT IN (

SELECT products_id   FROM `products_description`

WHERE language_id =@target_lang

);

#补齐缺失的语言(分类)

INSERT INTO `categories_description`

(categories_id,language_id,categories_name,categories_description )

SELECT categories_id,@target_lang AS language_id,categories_name,categories_description

FROM `categories_description`

WHERE language_id =@default_lang

AND categories_id NOT IN (

SELECT categories_id FROM `categories_description`

WHERE language_id =@target_lang

);

#补齐缺失的语言(产品META)
INSERT INTO `meta_tags_products_description`

( products_id, language_id, metatags_title, metatags_keywords, metatags_description )

SELECT products_id, @target_lang AS language_id, metatags_title, metatags_keywords, metatags_description

FROM `meta_tags_products_description`

WHERE language_id=@default_lang

AND products_id NOT IN (

SELECT products_id   FROM `meta_tags_products_description`

WHERE language_id =@target_lang

);

#补齐缺失的语言(分类META)
INSERT INTO `meta_tags_categories_description`

( categories_id, language_id, metatags_title, metatags_keywords, metatags_description )

SELECT categories_id, @target_lang AS language_id, metatags_title, metatags_keywords,metatags_description

FROM `meta_tags_categories_description`

WHERE language_id=@default_lang

AND categories_id NOT IN (

SELECT categories_id   FROM `meta_tags_categories_description`

WHERE language_id =@target_lang

);

声明: 本文由( admin )原创编译,转载请保留链接: ZenCart补齐缺失的多语言SQL

ZenCart补齐缺失的多语言SQL:等您坐沙发呢!

发表评论


------====== 本站公告 ======------
联系信息:
lxq73061#qq.com qq:583964941
支付宝:https://me.alipay.com/lxq73061
相关插件程序等信息均会在站内发布,敬请关注。

读者排行