예제 #1
0
파일: -Create.php 프로젝트: Eximagen/3m
        $prdID=(int)ProductCore::getProductIdByReference($product_xml->ItemNumber);
		if($prdID<477)
			continue;
        //Update an existing product or Create a new one 
        $resources->reference = $product_xml->ItemNumber;
        $resources->price = floatval($product_xml->BasePrice);
        $resources->wholesale_price = floatval($product_xml->LowestPrice);
        $category = CategoryCore::searchByNameAndParentCategoryId(1, $product_xml->Category,12);
        if(!isset($category['id_category'])){
            $category_id = add_new_category($product_xml->Category,12);
        }
        else{
            $category_id = $category['id_category'];
        }
        
        $sub_category = CategoryCore::searchByNameAndParentCategoryId(1, $product_xml->SubCategory,$category_id);
        if(!isset($sub_category['id_category'])){
           $sub_category_id = add_new_category($product_xml->SubCategory,$category_id);
       }
       else{
           $sub_category_id = $sub_category['id_category'];
       }
       $resources->associations->categories->addChild('categories')->addChild('id',intval($sub_category_id));
       $resources->id_category_default = intval($sub_category_id);        

        $resources->associations->categories->addChild('categories')->addChild('id',intval($category_id));
            
        //var_dump($sub_category_id,$category_id);
        $resources->item_number = $product_xml->ItemNumber;
        $parameter = array("ItemNumber"=>$product_xml->ItemNumber,
			"key"=>"8770471727");