Return to Snippet

Revision: 40636
at February 4, 2011 16:29 by ericmuyser


Initial Code
$session_key = time();
// Create the product object and initialize its fields
$product = Shop_Product::create();
$product->categories = array(1);
$product->price = 100;
$product->product_type_id = Shop_ProductType::create()->find_by_name('Goods')->id;
$product->url_name = 'test_product';
$product->name = 'Test product';
$product->sku = 'test_product_01';
$product->tax_class_id = Shop_TaxClass::get_default_class_id();
// Create price tier and save
$price_tier = Shop_PriceTier::create();
$price_tier->customer_group_id = 1;
$price_tier->quantity = 1;
$price_tier->price = 50;
$price_tier->save();
// Add the price tier to the product
$product->price_tiers->add($price_tier, $session_key);
// Save the product
$product->save(null, $session_key);

Initial URL

                                

Initial Description

                                

Initial Title
ls create products via api

Initial Tags

                                

Initial Language
PHP