X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Add column to order (https://forum.x-cart.com/showthread.php?t=69468)

Deepvas 06-30-2014 11:53 AM

Add column to order
 
Hello, I am using xcart 5.1.3.

I am trying to add a column to the order model as I want a checkbox at checkout to update it.

I have a module with the following code.


PHP Code:

<?php
namespace XLite\Module\NameOfDeveloper\TaxRelief\Model;

/**
 * order repository
 */
class Order extends \XLite\Model\Order implements \XLite\Base\IDecorator
{
    
/**
     * agree to vat relief on order form
     *
     * @return boolean
     */
    
protected $agreeToVatRelief;

}


And I also have a install.yaml file like so:

Code:

XLite\Model\Order\Modifier:
  - { class: '\XLite\Module\NameOfDeveloper\TaxRelief\Model\Order', weight: 1000 }


My build gets stuck here:

Code:

Re-building cache [step 4 of 9], please wait...

Run the "Doctrine_Plugin_PrepareDBSchema" plugin...



1)How do I rebuild when my build get stuck like this??

2)Is there any problems with what I have done?

Thanks

tony_sologubov 07-01-2014 05:45 AM

Re: Add column to order
 
Could you please provide the error messages from the var/log folder in your installation?

Besides that, do I understand you correctly that you want to allow customers to say that they are going to have a tax-free order?

Deepvas 07-01-2014 06:55 AM

Re: Add column to order
 
Thanks for the reply!

On checkout I wanted a customer to say they would like a Tax free order yes, but only do the tax deduction to certain products which admin have flagged as VatFreeAvailable(or possibly have certain attribute or class?).

The approach I was going to take was decorate the product and order models like so:

Product with $vatReliefable;
Order with $agreeToVatRelief;

Then possibly override the XLite\Module\CDev\VAT\Logic\Order\Modifier\Tax Calculate method. To say something like:

PHP Code:

if ($item->vatReliefable && $order->agreeToVatRelief)
{
     
//Don't add tax and take away tax % from price



Then add a checkbox on the checkout which changes agreeToVatRelief to true/false and reloads the page.

Any input on if this is a viable/good idea, would be great!
Ill get back to you on my log files.

Thanks.

Deepvas 08-04-2014 12:03 AM

Re: Add column to order
 
Could I get some feedback on this approach?

because my build goes into infinite maintenance mode 80% of the time and gets stuck on the step below(5.1.4) , and makes it almost impossible to do it via trail and error. Thanks

On my Linux Redhat box:
Code:

Deploying store [step 10 of 11], please wait...
Run the "LessParserAdmin" plugin...


On my xxamp windows local:

Code:

Deploying store [step 5 of 11], please wait...

Run the "Doctrine_Plugin_UpdateSchema" plugin...


tony_sologubov 08-05-2014 04:46 AM

Re: Add column to order
 
Hi Deepvas!

Thank you for explaining it. This is really interesting task and I would be really interested in describing it thoroughly in our dev docs. Will it be OK with you if I can provide code sample in about a month?

As for cache regeneration, do you have any error messages in the <X-Cart 5>/var/log/ folder?

Tony.

Deepvas 08-05-2014 06:08 AM

Re: Add column to order
 
Quote:

Originally Posted by tony_sologubov
Hi Deepvas!

Thank you for explaining it. This is really interesting task and I would be really interested in describing it thoroughly in our dev docs. Will it be OK with you if I can provide code sample in about a month?

As for cache regeneration, do you have any error messages in the <X-Cart 5>/var/log/ folder?

Tony.


Yes, that would be great and a even better learning experience, thank you.

I have rebuilt my Linux server and it's behaving better now thanks so should be ok(windows won't work however).

A real world example is here: Where you can see the text "VAT Relief is available if you make a declaration in the Shopping Basket", with a check-box at checkout.

Thanks and I am looking forward to hearing from you.

tony_sologubov 08-08-2014 01:54 AM

Re: Add column to order
 
Happy to hear that it would work good for you!

If you experience problems with running X-Cart 5 on Windows, please try to apply fix described here:
http://forum.x-cart.com/showpost.php?p=375710&postcount=15

This problem will be fixed in 5.1.5.


All times are GMT -8. The time now is 03:12 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.