Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
Ohm_Boy (Guest)
Ohm_Boy (Guest)
The shopping cart seems to be a nice product, but my application is for software, which can be downloaded, and the serial number (or registration code) is actually generated in our web code based upon a set of criteria, most of which is gathered in the order process. This code is then sent to the user in the confirmation email upon successful payment.
 
I can see that ViArt Shop can make random serial numbers, of pull from a list, but can it call a custom key generator function? We have our reg code generation script in PHP, but need a method of integrating it into the cart.
 
Thanks.
 
Monk
Monk
Hello Ohm_Boy,
 
Check the file includes/orders_items.php and find there
generate_serial() function.
 
In this function available block for random generation which I think you need to rewrite a little.
 
Hope it helps you.
 
Ohm_Boy (Guest)
Ohm_Boy (Guest)
Sounds good. I'll give it a shot.
 
Thank you.
 
flitehaus
flitehaus
We would like to implement the same algorithm to our version of the cart. Does anyone know the name of the variables that hold buyers first name, last name, and product's sku ? I found the generate_serial function, I just need access to those variables in order to generate the serial for our software.
 
Thank you.
 
flitehaus
flitehaus
Accomplished the task with the help of support and modifying generate_serial function in order_item.php
 
/**
* get_order_info
* function takes in the order item id and returns the first name, last name, and sku of the product
* purchased by the paying customer.
*
* @param int $order_item_id
* @return array $order_info
*/
function get_order_info($order_item_id)
{
global $db, $table_prefix;
 
$order_info = array();
 
$sql = "SELECT o.first_name, o.last_name, oi.item_code FROM " .$table_prefix. "orders o, " .$table_prefix. "orders_items oi WHERE oi.order_id=o.order_id AND oi.order_item_id=$order_item_id";
$db->query($sql);
if($db->next_record())
{
$order_info["first_name"] = $db->f("first_name");
$order_info["last_name"] = $db->f("last_name");
$order_info["sku"] = $db->f("item_code");
}
 
return($order_info);
 
}