2012年5月31日星期四

Magento import map, customization options (3)

If you do not see the first two introduce the quantities of imported articles, please read the previous two articles.fridge magnet cartoon soft rubber
 
Magento import map, customization options
 
Magento import map, custom options (2)[莆田论坛]
 
Use this plugin to import the custom option when we found that import order customization options, in alphabetical order.
 
For example, we import the Color drop-down menu, the order of the attributes of our csv file is: red, blue, white. But after import, we found that their order has become: blue, red, white. Is arranged in alphabetical order.tn nike requin
 
We need to modify the plugin code to fix this problem.
 
Need to modify the plug-in file path: app \ code \ community \ CapacityWebSolutions \ ImportProduct \ the Model \ the Convert \ Adapter \ product.php
 
The code fragment: in about 132 lines of position, add the $ i variable, about 210 lines of position, the value of the sort_order replaced $ i + +, so it will import value in accordance with the import order to set the sort of weight.nike requin


[code]$ I = 0; foreach ($ importData as $ field => $ value) {if (in_array ($ field, $ this-> _inventoryFields)) {continue;} if (in_array ($ field, $ this-> _imageFields)) {continue;} $ attribute = $ this-> getAttribute ($ field); if (! $ attribute) {if (strpos ($ field, ':')! == FALSE && strlen ($ value)) {$ values ​​= explode ('|', $ value); if (count ($ values)> 0) {@ list ($ title, $ type, $ is_required, $ sort_order) = explode (':', $ field); $ title = ucfirst (str_replace ('_', '', $ title)); $ custom_options [] = array ('is_delete' => 0, 'title' => $ title, 'previous_group' =>'', 'previous_type' = >'', 'type' => $ type, 'is_require' => $ is_required, 'sort_order' => $ sort_order, 'values' => array ()); foreach ($ values ​​as $ v) {$ parts = explode (':', $ v); $ title = $ parts [0]; if (count ($ parts)> 1) {$ price_type = $ parts [1];} else {$ price_type = 'fixed';} if (count ($ parts)> 2) {$ price = $ parts [2];} else {$ price = 0;} if (count ($ parts)> 3) {$ sku = $ parts [3];} else {$ sku ='';} if (count ($ parts)> 4) {$ sort_order = $ parts [4];} else {$ sort_order = 0;} switch ($ type) {case 'file': break ; case 'field': case 'area': $ custom_options [count ($ custom_options) - 1] ['max_characters'] = $ sort_order; case 'date': case 'date_time': case 'time': $ custom_options [count ($ custom_options) - 1] ['price_type'] = $ price_type; $ custom_options [count ($ custom_options) - 1] ['price'] = $ price; $ custom_options [count ($ custom_options) - 1] ['sku '] = $ sku; break; case' drop_down ': case' radio ': case' checkbox ': case' multiple ': default: $ custom_options [count ($ custom_options) - 1] [' values'] [] = array ('is_delete' => 0, 'title' => $ title, 'option_type_id' => -1, 'price_type' => $ price_type, 'price' => $ price, 'sku' => $ sku, 'sort_order '=> $ i + +); break;}}}} continue;}[/code]fridge magnet

没有评论:

发表评论