News:

Looking for documentation? Take a look on our wiki

Main Menu

Extending Checkout with 2 fields

Started by sprengarda, March 04, 2013, 19:45:50 PM

Previous topic - Next topic

sprengarda

Hi,
i want to add to additional fields to the check out progress and i'm not sure if i have all files modified.
First i modified the table xxx_virtuemart_orders my 2 fields (customer_order_number and customer_machine_number).
Next i modified the file administrator\components\com_virtuemart\tables\orders.php and added the entry var $customer_order_number = ''; and var $customer_machine_number = '';.
After that i edited the file administrator\components\com_virtuemart\models\orders.php and added to the function _createOrder the two entries $_orderData->customer_order_number = $_cart->customer_order_number; and $_orderData->customer_machine_number = $_cart->customer_machine_number;
Next i modified the file components\com_virtuemart_helpers\cart.php. I added the following lines here:
var $customer_order_number = '';
var $customer_machine_number = '';
function getCart --> added self::$_cart->customer_order_number   = $sessionCart->customer_order_number; and self::$_cart->customer_machine_number   = $sessionCart->customer_machine_number;
function setCartIntroSession --> sessionCart->customer_order_number   = $this->customer_order_number; and sessionCart->customer_machine_number   = $this->customer_machine_number;
function checkoutData --> $this->customer_order_number = JRequest::getVar('customer_order_number', $this->customer_order_number); and $this->customer_machine_number = JRequest::getVar('customer_machine_number', $this->customer_machine_number);
function emptyCartValues ..>  $cartData->customer_order_number = ''; and  $cartData->customer_machine_number = '';
In the last step i edited my templatefolder\com_virtuemart\cart\default.php with    <?php echo JText::_('TM_VIRTUEMART_CART_CUSTOMER_ORDER_INFO_ORDER_NUMBER'); ?>
   <input type="text" name="customer_order_number"
                      value="<?php echo $this->cart->customer_order_number;?>" >
and    <?php echo JText::_('TM_VIRTUEMART_CART_CUSTOMER_ORDER_INFO_MACHINE_NUMBER'); ?>
   <input type="text" name="customer_machine_number"
                      value="<?php echo $this->cart->customer_machine_number;?>" >

Have a done all steps to hack the checkout or did i forget some files to hack?

sprengarda

For everbody how have the same problem. You only have to do this steps and you can use this two fields in the checkout. Also you have to made the changes in the admin view Order.