Jump to content

Instructions to work with php


nurimaso

Recommended Posts

I'm not a user of Pretashop but I have to create an application that inserts a new product to database through PHP page.

 

I find some orders that work but, is there any tutorial where could I found a list of all orders to add, update, delete products and add them to cart too?

 

Have you have any code to do it to incorporate in an PHP file?

Link to comment
Share on other sites

Sorry but I think I didn't explain so good.

 

I want to create a PHP file with code to control products. I want to add, update or delete them and add to cart using orders of Prestashop.

 

Something like this:

 

$product = new Product();

$product->ean13 = 9999999999999;
$product->name = array((int)Configuration::get('PS_LANG_DEFAULT') =>  $descripcio);
$product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') =>  $descripcioAmical);
$product->reference = $referencia;
$product->id_category = 129;
$product->id_category_default = 129;
$product->redirect_type = '404';
$product->price = $preu;
$product->quantity = $quantitat;
$product->minimal_quantity = 1;
$product->show_price = 1;
$product->on_sale = 0;
$product->online_only = 1;
$product->meta_keywords = 'test';
$product->is_virtual=0;
$product->active = 1; // sets the product as active for shop
$product->add();
$product->addToCategories(array(2));
$shops = Shop::getShops(true, null, true);
 
 
Actually I have my products add and delete solved. I wanted to modify them.
 
Later I need code to insert the new product added to database to cart. I fins some codes in internet but none of them is working now.
Link to comment
Share on other sites

I'm working with a external database placed in another server. I can't access to that server, I only receive parameters. It will send the new product to be inserted in Prestashop database and then to the cart.

 

So, when client click on external cart button I access to an PHP page in Prestashop that insert product in Prestashop database if it doesn't exist of update it if it exist. Then it has to add this item to cart.

 

Now insertion of product in database is working for me but I can't found a valid code to insert the product to cart.

 

My client don't won't I use Web Service proposed by Prestashop tutorials because it means that curl.dll has to be enabled and my client don't want to do it.

 

Any suggestions of code to insert programmatically a new item to cart?

Link to comment
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
×
×
  • Create New...