Prestashop DropShipping Module

I need to integrate Prestashop with a Dropshipper but no modules were available for it.
I created an empty module using these instructions, then I added an Hook Function linked to Payment
public function hookactionPaymentConfirmation($params)
//the thing you want to do when the hook's executed goes here
$order = new Order((int)$params['id_order']);
$address = new Address((int)$order->id_address_delivery);
$state = new State((int)$address->id_state);
$country = new Country((int)$state->id_country);
$product_list = $order->getOrderDetailList();

$prodotti = '[';
                foreach ($product_list as $product)
if ($prodotti != '[')
$prodotti .= ',';
$prodotti .= '{"codice": "'.$product['product_reference'].'", "qta": '.$product['product_quantity'].'}';

$prodotti .= ']';


If you need to verify the stock availability you need to override the Cart Class for the function checkProductsAccess and remove the product from the cart if it's not available

public function checkProductsAccess()
foreach ($this->getProducts() as $product) {
if ($avail = 0)  
return $product['id_product'];
        return false;
Share on Google Plus

About Vittorio Pavesi

    Blogger Comment
    Facebook Comment

0 commenti: