Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Add column to order

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 06-30-2014, 11:53 AM
 
Deepvas Deepvas is offline
 

Newbie
  
Join Date: Jan 2007
Posts: 6
 

Default 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
__________________
Deepvas
X Cart Gold
Version 4.1.9
AOM
DSEFU
Reply With Quote
  #2  
Old 07-01-2014, 05:45 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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?
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
Deepvas (08-04-2014)
  #3  
Old 07-01-2014, 06:55 AM
 
Deepvas Deepvas is offline
 

Newbie
  
Join Date: Jan 2007
Posts: 6
 

Default 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
X Cart Gold
Version 4.1.9
AOM
DSEFU
Reply With Quote
  #4  
Old 08-04-2014, 12:03 AM
 
Deepvas Deepvas is offline
 

Newbie
  
Join Date: Jan 2007
Posts: 6
 

Default 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...
__________________
Deepvas
X Cart Gold
Version 4.1.9
AOM
DSEFU
Reply With Quote
  #5  
Old 08-05-2014, 04:46 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
Deepvas (08-05-2014)
  #6  
Old 08-05-2014, 06:08 AM
 
Deepvas Deepvas is offline
 

Newbie
  
Join Date: Jan 2007
Posts: 6
 

Default 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.
__________________
Deepvas
X Cart Gold
Version 4.1.9
AOM
DSEFU
Reply With Quote
  #7  
Old 08-08-2014, 01:54 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:19 AM.

   

 
X-Cart forums © 2001-2020