VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Priyal on December 01, 2016, 14:52:52 PM

Title: Adding custom filed to cart checkout session
Post by: Priyal on December 01, 2016, 14:52:52 PM
I've added a custom field over VM checkout . I need that bill amount is saved on selection of this field in orders table . Currently this is the response array before saving cart details to orders table :
Array
(
    [basePrice] => 257
    [basePriceWithTax] => 272.42
    [discountedPriceWithoutTax] => 257
    [salesPrice] => 272.42
    [taxAmount] => 15.42
    [salesPriceWithDiscount] => 0
    [discountAmount] => 0
    [priceWithoutTax] => 257
    [subTotalProducts] => 0
    [billTotal] => 272.42
    [5Diff] => -15.42
   
Title: Re: Adding custom filed to cart checkout session
Post by: Priyal on December 02, 2016, 09:42:16 AM
Hi All,

Nobody over this?
Title: Re: Adding custom filed to cart checkout session
Post by: jenkinhill on December 02, 2016, 11:36:56 AM
Hmmm.  http://forum.virtuemart.net/index.php?topic=104795.0
Title: Re: Adding custom filed to cart checkout session
Post by: Priyal on December 03, 2016, 13:33:42 PM
I've added a shopper field (as single checkbox) named Tax Exemption. Whenever a user checks it, tax amount added to product is removed and vice versa. I've used this shopper field id in my script for calculation purposes.
Now , when final checkout is done and cart values are stored in table (order details) , I want that this value is carried to cart session so that on basis of its selection I store the total amount to order table .

I'm using VirtueMart 3.0.18 on Joomla 3.3.6 php 5.4.45

The details which I'm getting in administrator\components\com_virtuemart\models\orders.php is this :
Array
(
    [basePrice] => 257
    [basePriceWithTax] => 272.42
    [discountedPriceWithoutTax] => 257
    [salesPrice] => 272.42
    [taxAmount] => 15.42
    [salesPriceWithDiscount] => 0
    [discountAmount] => 0
    [priceWithoutTax] => 257
    [subTotalProducts] => 0
    [billTotal] => 272.42
    [5Diff] => -15.42
   
=> Array

        (
            [virtuemart_product_price_id] => 86
            [virtuemart_product_id] => 1257
            [virtuemart_shoppergroup_id] => 0
            [product_price] => 257
            [override] => 0
            [product_override_price] => 0
            [product_tax_id] => 0
            [product_discount_id] => 0
            [product_currency] => 144
            [product_price_publish_up] => 0000-00-00 00:00:00
            [product_price_publish_down] => 0000-00-00 00:00:00
            [price_quantity_start] => 0
            [price_quantity_end] => 0
            [created_on] => 2016-08-05 13:06:49
            [created_by] => 814
            [modified_on] => 2016-11-17 10:57:17
            [modified_by] => 814
            [locked_on] => 0000-00-00 00:00:00
            [locked_by] => 0
            [costPrice] => 257
            [basePrice] => 257
            [basePriceVariant] => 257
            [basePriceWithTax] => 272.42
            [discountedPriceWithoutTax] => 257
            [priceBeforeTax] => 257
            [salesPrice] => 272.42
            [taxAmount] => 15.42
            [salesPriceWithDiscount] => 0
            [salesPriceTemp] => 272.42
            [unitPrice] => 0
            [priceWithoutTax] => 257
            [discountAmount] => -0
            [variantModification] => 0
            [DBTax] => Array
                (
                )

            [Tax] => Array
                (
                )

            [VatTax] => Array
                (
                    [5] => Array
                        (
                           
=> Default tax
[1] => 6.0000
                            [2] => +%
                            [3] => 0
                            [4] => 47
                            [5] =>
                            [6] => 1
                            [7] => 5
                        )

                )

            [DATax] => Array
                (
                )

           
[Marge] => Array
                (
                )

            [subtotal_with_tax] => 272.42
        )

    [salesPriceDBT] => Array
        (
        )

    [taxRulesBill] => Array
        (
        )

    [DATaxRulesBill] => Array
        (
        )

    [toTax] => 272.42
    [salesPriceCoupon] => 0
    [withTax] => 272.42
    [shipmentValue] => 0
    [shipmentTax] => 0
    [salesPriceShipment] => 0
    [shipment_calc_id] => 0
    [cost] => 0
    [paymentValue] => 0
    [paymentTax] => 0
    [paymentTotal] => 0
    [salesPricePayment] => 0
    [payment_calc_id] => 0
    [payment_tax_id] => 0
    [payment_value] => 0
    [billSub] => 257
    [billDiscountAmount] => 0
    [billTaxAmount] => 15.42
)

I want that checkbox value included in this array . How this can be achieved ?
Title: Re: Adding custom filed to cart checkout session
Post by: Priyal on December 06, 2016, 10:19:06 AM
Hi All,

I really need to do this. Is there anyone who could help me over this?

Thanks In Advance!
Title: Re: Adding custom filed to cart checkout session
Post by: Milbo on December 07, 2016, 20:41:47 PM
I think your problem is solved. You should just use what is already there. If not, you need a plugin like avatax. At least 20% of it. Learn our rules system. What you wanna do is very, very tricky. Not by what you want todo, but the effects. You work with internal data without understanding the whole thing. It makes a lot more sense to learn the calculation rules first.
Title: Re: Adding custom filed to cart checkout session
Post by: Priyal on December 08, 2016, 13:37:19 PM
Hi Milbo

Thank you for your reply. I'l find about the rules you mentioned.
"Avatax" means Avalara?right? Do I need to register over their website http://www.avalara.com/