1
votes

I'm developing a module for my Prestashop website and I'm stuck for hours now on a thing. I use Prestashop 1.7.5.1.

Here is the use case :

Some products are set in the default category "preorder" who have the ID 21. When a customer buy an article who is in this category, I would like to automatically change the order state ID to the preorder ID. The order state ID for the preorder is 18.

Here is the code :

public function hookDisplayOrderConfirmation($params) { $objOrder = $params['order'];

    $products = $objOrder->getProducts();
    foreach ($products as $product)
    {
        $cat = (int)$product->id_category_default;
        if($cat == 21)
        {
            $history = new OrderHistory();
            $history->id_order = $objOrder->id;
            $history->changeIdOrderState(18, $objOrder->id);
            break;
        }
    }
}

By the way, where I can find all the class and method of Prestashop ? for example, where I can find all the variable of the $objOrder above ?



Thanks a lot for your support :) and have a nice day !

1

1 Answers

0
votes

You can find all the variable of Order object inside [prestashop]/classes/order/Order.php class. Here you can find all the variable and function/ methods related to the Order object.