Jump to content

Using the Product Obj


erme2
 Share

Recommended Posts

Hi,
I'm new in prestashop, I'm importing products, manufacturer, categories and sub categories from a bigger and deeper management software. I must auto-update daily theese data, so I can't use CSV import.

I used /prestashop/classes/Category.php to import ad update categories, Manufacturer for manufacturers ...
I'm now tryng to import product using class Product

include("prestashop/config/config.inc.php");
$prod = new Product();
// ... adding all data
$prod->add();



The code done insert and populated products tables, but I can't see products in the shop or in the backoffice. I'm shure I miss something BIG but I can't see what! Can you help me?

Thanks...

That's a print_r(new Product(10));

Product Object
(
   [id_tax] => 1
   [tax_name] => 
   [tax_rate] => 
   [id_manufacturer] => 3
   [id_supplier] => 3
   [id_category_default] => 81
   [id_color_default] => 0
   [manufacturer_name] => 
   [supplier_name] => 
   [name] => Array
       (
           [1] => BAE A47572
           [3] => BAE A47572
       )

   [description] => Array
       (
           [1] => - potenza assorbita 1800W
- giri a vuoto 4100
- dischi mm.185
- larghezza fresatura mm.9-43
- profondit
           [3] => - potenza assorbita 1800W
- giri a vuoto 4100
- dischi mm.185
- larghezza fresatura mm.9-43
- profondit
       )

   [description_short] => Array
       (
           [1] => - potenza assorbita 1800W
- giri a vuoto 4100
- dischi mm.185
- larghezza fresatura mm.9-43
- profondit
           [3] => - potenza assorbita 1800W
- giri a vuoto 4100
- dischi mm.185
- larghezza fresatura mm.9-43
- profondit
       )

   [quantity] => 100
   [available_now] => Array
       (
           [1] => 
           [3] => 
       )

   [available_later] => Array
       (
           [1] => 
           [3] => 
       )

   [price] => 967.500000
   [wholesale_price] => 0.000000
   [reduction_price] => 0.00
   [reduction_percent] => 0
   [reduction_from] => 2010-05-12
   [reduction_to] => 2010-05-12
   [on_sale] => 0
   [ecotax] => 0.00
   [reference] => 
   [supplier_reference] => 
   [location] => 
   [weight] => 6
   [ean13] => 
   [link_rewrite] => Array
       (
           [1] => baea4757
           [3] => baea4757
       )

   [meta_description] => Array
       (
           [1] => 
           [3] => 
       )

   [meta_keywords] => Array
       (
           [1] => 
           [3] => 
       )

   [meta_title] => Array
       (
           [1] => 
           [3] => 
       )

   [out_of_stock] => 2
   [quantity_discount] => 0
   [customizable] => 0
   [new] => 
   [uploadable_files] => 0
   [text_fields] => 0
   [active] => 1
   [indexed] => 0
   [date_add] => 2010-05-12 12:00:13
   [date_upd] => 2010-05-12 12:00:13
   [tags] => 
   [tables:protected] => Array
       (
           [0] => product
           [1] => product_lang
       )

   [fieldsRequired:protected] => Array
       (
           [0] => id_tax
           [1] => quantity
           [2] => price
       )

   [fieldsSize:protected] => Array
       (
           [reference] => 32
           [supplier_reference] => 32
           [location] => 64
           [ean13] => 13
       )

   [fieldsValidate:protected] => Array
       (
           [id_tax] => isUnsignedId
           [id_manufacturer] => isUnsignedId
           [id_supplier] => isUnsignedId
           [id_category_default] => isUnsignedId
           [id_color_default] => isUnsignedInt
           [quantity] => isUnsignedInt
           [price] => isPrice
           [wholesale_price] => isPrice
           [reduction_price] => isPrice
           [reduction_percent] => isFloat
           [reduction_from] => isDate
           [reduction_to] => isDate
           [on_sale] => isBool
           [ecotax] => isPrice
           [reference] => isReference
           [supplier_reference] => isReference
           [location] => isReference
           [weight] => isFloat
           [out_of_stock] => isUnsignedInt
           [quantity_discount] => isBool
           [customizable] => isUnsignedInt
           [uploadable_files] => isUnsignedInt
           [text_fields] => isUnsignedInt
           [active] => isBool
           [ean13] => isEan13
       )

   [fieldsRequiredLang:protected] => Array
       (
           [0] => link_rewrite
           [1] => name
       )

   [fieldsSizeLang:protected] => Array
       (
           [meta_description] => 255
           [meta_keywords] => 255
           [meta_title] => 128
           [link_rewrite] => 128
           [name] => 128
           [available_now] => 255
           [available_later] => 255
       )

   [fieldsValidateLang:protected] => Array
       (
           [meta_description] => isGenericName
           [meta_keywords] => isGenericName
           [meta_title] => isGenericName
           [link_rewrite] => isLinkRewrite
           [name] => isCatalogName
           [description] => isCleanHtml
           [description_short] => isCleanHtml
           [available_now] => isGenericName
           [available_later] => IsGenericName
       )

   [table:protected] => product
   [identifier:protected] => id_product
   [id] => 10
   [category] => 81

)

Share this post


Link to post
Share on other sites

It's hard to tell without looking at your BO / database...

Try entering a product from the BO and do a print_r for it and compare (also compare in the db and see what's missing)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More