Announcement

Collapse
No announcement yet.

Can products be sold in multiples only?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can products be sold in multiples only?

    If you have certain products that are priced per item, but sold in multiples (such as 10) you will need to edit one of the scripts to enable this.

    In the softwares standard configuration you can set the minimum order, in this example 10, but this will still allow customers to purchase 15 of the item.

    Software prior to v11

    To do this please open the script: -

    ActinicOrder.pm

    in a plain text editor (such as 'notepad'), and search for: -

    sub CheckProductQuantity

    Scroll down and locate the following lines: -

    Code:
    #
    # Check is out of stock
    #
    if ($$pProduct{'OUT_OF_STOCK'})
            {
            $sMessage .= ACTINIC::GetPhrase(-1, 297, $$pProduct{'NAME'}) .
    "<P>\n";
            $nFailure = 1;
            $nBadQuantity = $nQuantity;
            }
    return ($nFailure, $nBadQuantity, $sMessage);
    and replace it with the following code:-

    Code:
            elsif ($nQuantity % $$pProduct{"MIN_QUANTITY_ORDERABLE"} != 0)
                    {
                    $sMessage .= "The quantity should be a multiple of " .
                    $$pProduct{"MIN_QUANTITY_ORDERABLE"} . "<P>\n";
                    $nFailure = 1;
                    $nBadQuantity = $nQuantity;
                    }
        #
        # Check is out of stock
        #
        if ($$pProduct{'OUT_OF_STOCK'})
            {
            $sMessage .= ACTINIC::GetPhrase(-1, 297, $$pProduct{'NAME'}) . "<P>\n";
            $nFailure = 1;
            $nBadQuantity = $nQuantity;
            }
        return ($nFailure, $nBadQuantity, $sMessage);
        }
    Then save and closed the file.

    Then go to the relevant product or products and change the 'Minimum Quantity' field to the multiple that the products are available in (10 in our example above).
    Once you have done this upload the site for the changes to take effect.
    Now when a customer enters the number to purchase in the 'Quantity' box of the product, the multiple value will be used, i.e. if a customer enters 2 in the 'Quantity' box, the will order 20 using our example here.

    From this point the quantity entered into the the 'Quantity'

    V11 Onwards

    Edit ActinicOrder.pm in the site folder in a plain text editor (such as 'notepad') and search for: -

    sub CheckProductQuantity

    scroll down and locate the following line: -

    Code:
    return ($nResult, $nBadQuantity, $sMessage);
    before the above line insert the following

    Code:
    elsif ($nQuantity % $$pProduct{"MIN_QUANTITY_ORDERABLE"} != 0)
    {
    $sMessage .= "The quantity should be a multiple of " . $$pProduct{"MIN_QUANTITY_ORDERABLE"} . "<P>\n";
    $nResult = $::FAILURE;
    $nBadQuantity = $nQuantity;
    }
    save and exit

    Then go to the relevant product or products and change the 'Minimum Quantity' field to the multiple that the products are available in and update the site.
Working...
X