| Autor | Zpráva | ||
|---|---|---|---|
| Milda Profil * |
#1 · Zasláno: 17. 1. 2014, 15:08:39
Zdravím,
mám trochu problém s importem do eshopu. Konkrétně mi nejde importovat atributy. Neporadil by někdo kde mám chybu? xml: <product> <group_id>2</group_id> <variant_id>d04b95489bc4e2bc1187bbfa7ef0ba59</variant_id> <catalog_number>566</catalog_number> <ean>61758</ean> <name>Produkt</name> <producer>ALPISPORT</producer> <description>Krátký popis</description> <description_long>dlouhý popis</description_long> <vat>21</vat> <wholesale_price>850</wholesale_price> <wholesale_price_vat>1029</wholesale_price_vat> <price>0</price> <price_vat>0</price_vat> <on_stock>0</on_stock> <on_stock_external>0</on_stock_external> <images> <image>/files/images-goods/4.jpg</image> </images> <variants> <variant> <name>Velikost</name> <value>S</value> </variant> <variant> <name>Barva</name> <value>Černošedá</value> </variant></variants> </product> konfigurace: <?php defined('SQC') or die('No direct access.');
$import_options = array(
'datafile' => 'www_adresa_xml',
'datatype' => 'xml',
'product_element' => 'product',
'mode' => 0,
'delete_products' => 0,
'create_categories' => 1,
'variant_element' => '',
'category_parent' => '',
'files_target' => '',
'product_unique' => 'name',
'encoding' => '',
'elements' => array(
'name' => 'name',
'description' => 'description_long',
'price' => 'price_vat',
'cost' => 'wholesale_price_vat',
'files' => 'images/image',
'description_short' => 'description',
'manufacturers' => 'producer',
),
);
function import_variants($product, $data, $options){
$variants = array();
foreach($product->PARAM as $variants){
$name = (string) $variants->PARAM_NAME;
foreach($variant->VAL as $value) {
$variants[] = array(
'name' => $name,
'value' => (string) $value,
'price' => null
);
}
/*
$variants[] = array(
'name' => 'Barva/velikost',
'value' => (string) $variant->PARAM/PARAM_NAME,
'price' => null
);
}
*/
return $variants;
} |
||
|
Časová prodleva: 4 dny
|
|||
| Petr Ká Profil |
Přepisujete si proměnnou $variants z prvního FOREACH v druhém, respektive zřejmě máte překlep - myslel jste první foreach místo "as $variants" toto "as $variant" že?
|
||
|
Časová prodleva: 12 let
|
|||
0