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

  • Posts: 37
  • Thank you received: 1
9 years 8 months ago #173966

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.

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.
$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.

  • Posts: 26048
  • Thank you received: 4007
9 years 8 months ago #173969


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).


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

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