Skip to main content

Serial plugin - which uses product SKU, User Name and date of order

More
12 years 1 day ago #173966 by ruslan_zasukhin
Hi Guys,

so I have look on existed plugins of HikaSerial, and as far as I see,
any of this plugin use information from User/Product/Order.

Our serial-gen algorithm uses:
- Company name if specified, else UserName
- Order Date - to produce serial with encoded date
- SKU of product/variant to define with its help OS and product.

First of all, I have try to log values of params.
Code:
public function generate(&$pack, &$order, $quantity, &$serials) { error_log( "order_id = $order->order_id" );

Okay, I was able to print order_id, but have stick on products.
It is empty. I have try to load it, but then I get exception about SQL syntax error.
Code:
$orderClass = hikashop_get('class.order'); $orderClass->loadProducts( $order->order_id ); foreach( $order->products as $k => $product ) { error_log( "product_id = $product->product_id" ); error_log( "product_name = $product->product_name" ); }

so HOW TO?

Please Log in or Create an account to join the conversation.

More
12 years 1 day ago #173969 by Jerome
Hi,

The $order parameter is an object with some "order" data, like the cart content.
In this object, you can find all information you need.
My recommendation : make a "var_dump" of the $order (or use jdump / dbug... the lib you preferred)

And more than that, you didn't look at the "secure ebook" plugin which use data from the products (the product code).

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.138 seconds
Powered by Kunena Forum