欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

修改價格為原來的0.6154倍!!

系統 1682 0

?

修改價格為原來的0.6154倍!!

執行的語句

update catalog_product_index_price set price = round(price*0.6154),final_price = round(final_price*0.6154),min_price = round(min_price*0.6154),max_price = round(max_price*0.6154)




UPDATE catalog_product_entity_decimal val SET? val.value = round(val.value* 0.6154)? WHERE? val.attribute_id = 64

?

?

?

?

附:資料

http://fishpig.co.uk/magento-update-product-prices-globaly/

?

?

Magento: Update Product Prices?Globaly

Posted on the 7th of June, 2010 at 12:00pm

There are many ways to mass update product attributes in Magento, each well suited to a different purpose. Magento’s built-in mass product attribute updater is great if you want to modify a selection of products or the new attribute value is the same for all products you want to edit. Alternatively, if you wish to alter the attributes in more dynamic ways, updating them programmatic ally via PHP is probably a better way. The downside to both of these methods is speed, with each product update taking a few seconds to complete. While this time can be dramatically reduced by disabling indexing, the wait can still be too long for a store with a massive catalog. A more efficient way to update product attributes is to write direct SQL queries. As an example, I will show you how to mass update product pricing for all products, products from a certain store and products that use a certain attribute set.

Why would I want to mass update price?

When I was first asked to do this I asked myself the same question, however, the reason is quite simple. In Magento, shipping costs aren’t usually displayed to the user until they enter their delivery address. While this makes sense, the customer usually enters their delivery address during the checkout process, meaning a lot of customers weren’t aware of this extra cost. During a study of one site, I found that almost 30% of customers were leaving the store during checkout and that this bounce rate could almost definitely be attributes to the shipping cost. To remove this problem, it was decided I should add £6 (the shipping cost) on to every product price and offer free shipping instead. As soon as this was done a lot less people left the site during checkout!

How do I update product price globally?

In this first example, I will add £6 to every single product price.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
<?php
?
$priceToAdd = 6;
?
$write = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' );
$write ->query("
?? UPDATE catalog_product_entity_decimal val
?? SET? val.value = (val.value + $priceToAdd )
?? WHERE? val.attribute_id = (
????? SELECT attribute_id FROM eav_attribute eav
????? WHERE eav.entity_type_id = 4
??????? AND eav.attribute_code = 'price'
???? )
");

If you have a development site, add the code to a template file or run Magento’s code in an external PHP file and all of your products should now cost £6 more.

How do I update all prices from a certain store?

This technique is useful when working in a multi-store Magento environment. The SQL query used is very similar, except you will need to add a clause in the WHERE section to limit the records updated by store ID.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
<?php
?
$priceToAdd = 6;
$storeId = 4;
?
$write = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' );
$write ->query("
?? UPDATE catalog_product_entity_decimal val
?? SET? val.value = (val.value + $priceToAdd )
?? WHERE? val.attribute_id = (
????? SELECT attribute_id FROM eav_attribute eav
????? WHERE eav.entity_type_id = 4
??????? AND eav.attribute_code = 'price'
???? )
???? AND val.store_id = $storeId
");

How do I update all product prices with a certain attribute set?

The concept behind this is the same, however you will need to join an extra table so that you can filter using attribute_set_id.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
<?php
?
$priceToAdd = 6;
$attributeSetId = 4;
?
$write = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' );
$write ->query("
?? UPDATE catalog_product_entity_decimal val
?? SET? val.value = (val.value + $priceToAdd )
?? WHERE? val.attribute_id = (
????? SELECT attribute_id FROM eav_attribute eav
????? WHERE eav.entity_type_id = 4
??????? AND eav.attribute_code = 'price'
???? )
AND entity_id = (
??? SELECT p.entity_id FROM catalog_product_entity p
??? WHERE p.attribute_set_id = $attributeSetId
)
");

How do I update the Special Price?

This one is also extremely easy! If you take any of the above examples and swap ‘price’ for ‘special_price’ they will all work! See below for an example of how to update the special price for every product.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
<?php
?
$priceToAdd = 6;
?
$write = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' );
$write ->query("
?? UPDATE catalog_product_entity_decimal val
?? SET? val.value = (val.value + $priceToAdd )
?? WHERE? val.attribute_id = (
????? SELECT attribute_id FROM eav_attribute eav
????? WHERE eav.entity_type_id = 4
??????? AND eav.attribute_code = 'special_price'
???? )
");

These features only scratch the surface of the Magento database but should hopefully give you an insight into the possibility of modifying data directly in the database. This method is much quicker than the alternatives, however can go drastically wrong extremely easily. I would make sure you test ALL queries on a development server and always back up your live server before running a query!

修改價格為原來的0.6154倍!!


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 91茄子国产线观看免费 | 午夜精品在线 | 精品国精品国产自在久国产应用 | 精品欧美一区二区精品久久久 | 日韩亚洲一区中文字幕在线 | 一区二区三区免费看 | 欧美国产激情二区三区 | 免费99热在线观看 | 久久一日本道色综合久久 | 色在线视频网站 | 久久国产热视频 | 亚洲区在线播放 | 色综合久久中文字幕网 | 欧洲男女下面进出的视频 | 亚洲欧美第一页 | 国产小视频免费在线观看 | 伊人久久综合 | 久久日本精品国产精品白 | 91视频进入| 久久精品小短片 | 国产青青 | 欧洲成人午夜免费大片 | 欧美日韩国产在线 | 久久综合色播 | 亚洲精品AV无码永久无码 | www.日本在线播放 | 精品国产一区在线观看 | 色噜噜在线观看 | 亚洲精品国产网红在线 | 天天影院成人免费观看 | 国产福利视频 | 精品免费 | 国产日韩一区 | 一二区 | 一级黄色α片 | 2015小明看日韩成人免费视频 | 青娱分类视频精品免费2 | 99自拍视频在线观看 | 国产97人妻人人做人碰人人爽 | 一区二区三区在线免费看 | 精品免费视频 |