Author Topic: Serial number  (Read 4274 times)

Offline Claudio Garcia

  • Newbie
  • *
  • Posts: 35
  • Karma: +7/-0
    • View Profile
Serial number
« on: October 24, 2019, 05:56:46 PM »
I will explain with an example, what i want to config:

Product: Tablet1 - quantity 10 (all same)
Seriales number available: 1,2,3,4,55,61,34,22,58,70

Product:Tablet2 - quantity 5 (all same)
Seriales number available: 91,92,93,94,95

How its possible to show in order the serial number that customer buy. If a customer buy 2 tablet1 and 3 tablet2, show in order the serial numbers assign to the customer.

Thank you a lot for your help.


Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Serial number
« Reply #1 on: October 26, 2019, 08:00:11 PM »
I am trying to understand the type of the product you have.
Are you assigning serial numbers to the product during checkout or prior at product inventory management?

I think your product model very similar to software licenses type product. Licenses are assigned to each software copy purchased. 

See if this will work for you:
http://marketplace.abantecart.com/licensing
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Claudio Garcia

  • Newbie
  • *
  • Posts: 35
  • Karma: +7/-0
    • View Profile
Re: Serial number
« Reply #2 on: October 27, 2019, 03:31:32 AM »
Hello abantecart

Its not software license is at my Church yard sale
They have inventory code of chairs, tables, desks, tablecloths

i personalize the "bank transfer" as "Cash on hand" and i have all configure but my problem now is they want to delivery product based on  inventory code. So this is not way in Abatecart right now or yes? because i investigate in forum and in the settings and not found  info about.

They also ask that costumer buy only 3 products quantity per customer, becuase they want to give oportunities to all members to participate but this is not setting right now with Abantecart because has restriction by orders not by customer. I would like to know how but i havent found information

Thank you very much for your help.

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: Serial number
« Reply #3 on: October 27, 2019, 11:22:53 AM »
You are working in a very unique "selling" situation -  not something the mass users of an ecommerce platform would require . 
My suggestion for you to accomplish your unique conditions are as follows:

1. You can quickly and easily CLONE a product within your admim dashboard -  set up the first product and assign it the model number of the serial number.   Then clone (copy) that product.  Change the model number to the next serial number.   If there are variations on the two products you can state them in the description  or take a different picture.
2.  Add the Serial number info in the Blurb portion -  so customer can easily find the serial number they might want after looking thru the listings.
3.  Set  available quantity to 1 ,  so when it is sold there can be no more orders.

As to limiting the number of items to each customer -   Simply STATE your limitations on the home page  -  allow with what you will do to enforce that limitation -  a suggestion would be to say  ONLY your first three items will be sold to you, we will cancel your order for any additional items added to your cart.

Yes I understand this will require manual involvement of an administrator  -  but yard sales are not usually on going processes -  and your unique requirements are not something a third-party developer will want to spend time with (no other possible users!) so if you don't possess the coding skills to alter the cart to your specific requirement  the above seems like the best and quickest way to get your yard sale functional.
« Last Edit: October 27, 2019, 11:34:30 AM by llegrand »

Offline josevalle

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
    • Internetpasoapaso.com
Re: Serial number
« Reply #4 on: October 28, 2019, 02:57:01 PM »
Thanks for the help! I needed that! ;)

Offline Claudio Garcia

  • Newbie
  • *
  • Posts: 35
  • Karma: +7/-0
    • View Profile
Re: Serial number
« Reply #5 on: October 28, 2019, 04:06:06 PM »
Hello llegrand, Hello to all  I got it.

I investigate how to do the quantity restriction and found this:

I create a view in mysql workbech:
Code: [Select]
CREATE
    ALGORITHM = UNDEFINED
    DEFINER = `root`@`localhost`
    SQL SECURITY DEFINER
VIEW `bitnami_abantecart`.`products_customer` AS
    SELECT
        `ac_op`.`product_id` AS `product_id`,
        `ac_op`.`name` AS `product_name`,
        SUM(`ac_op`.`quantity`) AS `quantity_hist`,
        `ac_c`.`customer_id` AS `customer_id`
    FROM
        ((`bitnami_abantecart`.`ac_order_products` `ac_op`
        JOIN `bitnami_abantecart`.`ac_orders` `ac_o` ON (`ac_op`.`order_id` = `ac_o`.`order_id`))
        JOIN `bitnami_abantecart`.`ac_customers` `ac_c` ON (`ac_c`.`customer_id` = `ac_o`.`customer_id`))
    WHERE
        `ac_o`.`order_status_id` = 5
    GROUP BY `ac_op`.`product_id`,`ac_c`.`customer_id`

This view show product_id, product_name, customer_id and sum(quantity) group by product and customer, so i can ask for orders made in history by customer with status "5-Complete".

And modify this
Code: [Select]
htdocs\core\lib\cart.php from line 166
Code: [Select]
$product_result = $this->buildProductDetails($product_id, $quantity, $options);
            if (count($product_result)) {
                $product_data[$key] = $product_result;
                $product_data[$key]['key'] = $key;

// Query for max product per customer --- CG
$prod_query_customer = $this->db->query("SELECT * FROM products_customer WHERE customer_id =
'".(int)$this->customer->getId()."' and product_id = '".(int)$product_result['product_id']."' ");
$quantity_hist = $prod_query_customer->row['quantity_hist'];
$quantity_ask = $quantity_hist +  $product_result['quantity'];

if ( $quantity_hist >= $product_result['maximum']) {
$this->cust_data['error'] = "Ya compró " .$quantity_hist. " de " .$product_result['maximum']. " unidades permitidas de: " .$prod_query_customer->row['product_name']. ". El producto se ha retirado de su carro de compras. Por favor compre otros productos disponibles.";
$this->update($key, 0 );
}
elseif ($quantity_hist > 0 and ($quantity_ask > $product_result['maximum'])) {
$new_quantity = $product_result['maximum'] - $quantity_hist;
$this->cust_data['error'] = "Ya compró " .$quantity_hist. " de " .$product_result['maximum']. " unidades permitidas de: " .$prod_query_customer->row['product_name']. ". La cantidad solicitada se ha ajustado a " .$new_quantity. ". Por favor revise su pedido.";
$this->update($key, $new_quantity);
}

//else {

                //apply min and max for quantity once we have product details.
                // if ($quantity < $product_result['minimum']) {
                //    $this->language->load('checkout/cart', 'silent');
                //    $this->cust_data['error'] = $this->language->get('error_quantity_minimum');
                //    $this->update($key, $product_result['minimum']);
                //}
                //if ($product_result['maximum'] > 0) {
                //    $this->language->load('checkout/cart', 'silent');
                //    if ($quantity > $product_result['maximum']) {
                //        $this->cust_data['error'] = $this->language->get('error_quantity_maximum');
                //        $this->update($key, $product_result['maximum']);
                //    }
             //   }
            } else {
                $this->remove($key);
            }
        }

I had to comment the quantity validation made by order to apply per customer. I would like to make this validation in the product page, but in the checkout process is excellent too.

I know my solution is not the best but it work and very well.




« Last Edit: November 24, 2019, 11:29:44 AM by Claudio Garcia »

 

Powered by SMFPacks Social Login Mod