I am really sorry not being able to help even when i spent hours solving your modifications by email communication and I even provided you FTP access (for upload) to be able to work on this. Our component does as few hacks as possible in order to be easily installable, uninstallable and upgradable. Therefore if you have other modifications which are not "uninstallable" and are hard-coded in tens of your files and alter checkout process, coupon process we will have to merge them with our ps_onepage.php or optionally other files.
In general OPC is not recommended if
- you made hacks into shipping handling in ps_checkout and you use non-standard POST variable (other than shipping_rate_id) for saving the shipping
- you are using modifications which you did yourself and you cannot (or don't want) provide FTP access to let us make it compatible with your install
- you added a function to ps_checkout which instead of return values true/false does a redirect and is required for order processing
For everybody to understand if you want any extra variable which is depended on shipping to be shown on the checkout page you or us will need to edit every single file of onepage checkout. We are open and ready to make implementations which can be used on other customer's sites, but if your modification is used only at your site, you will have to buy "additional services" for us to help you with this.
The logic of the OPC is as follows:
1. shop.cart page loads basket.php
2. basket.php includes shiping file (ajaxhelper.php and shipping.php) which creates a variations of every shipping and payment incl. coupon and shows them in hidden input fields inline a special div
3. basket also loads your VM template files for listing payment methods, coupon code, user registration. This templates can be overriden when copied to OPC/overrides directory.
4. after shipping destination is changed, files ajaxhelper and shiping.php are loaded from javascript to get updated totals information and new list of shipping methods
5. javascript (onepage.js) updates totals (according to shipping fees and payment fees) and may set hidden input variables to be able to send them via POST on submit click
6. after submit button is clicked
ps_onepage is loaded insted of ps_checkout. The reason why we don't use ps_checkout (default order processing function in VM) is that it is using redirects and echo'es where it should use only logical return values such as true and false. We decided to incorporate any of your modifications in ps_checkout to our ps_onepage for free so you don't need to edit it for our component to work. It already has support for many custom modifications.
ps_onepage (main order saving file) has following logic:
- registers a user and logs him in if unlogged (registering a user is optional and can be turned off by joomla configuration) - uses own function shopper_add which is a modified version of ps_shopper->add(...
- adds shipping address (function add_shipto)
- validates input variables, shipping and payment fields (validate_add is a modified version ps_checkout->validate_add which return true or false instead of redirect to a checkout.index page)
- adds order (function addOrder which is a modified version of ps_checkout->add(
addOrder function stores all the POST variables which are being sent to other functions with $d variable. It can return true/false/5 where 5 is a problem with payment when a credit card payment cannot be validated. Most of the modifications to support external VM extensions such as Greek, UK and PayPal pro, AWO coupons, Italian coupons modifications were done inside this function to store the data as needed. This function calls ps_checkout functions with $thisch variable.
If you want to modify saving of the variables by your self, you can find helpfull these lines in addOrder function:
- Code: Select all
// Collect all fields and values to store them in jos_vm_orders !
$fields = array( 'columnname' => $d['yourPOSTvariable'FROMtheBASKET'];, .... )
to save any custom field for a product you can also use $dboi->f('column_name_in_your_vm_product_table'); to access session variables you can use $_SESSION but remember to use serialization
- Code: Select all
// here are the fields which are stored in jos_vm_order_item
// if you need to add any more you can do so here
$fields = array('order_id' => $order_id, 'yourCUSTOMproductFIELD'=>$d['yourPOSTvariable'] );
7. on sucess, the page is redirected to checkout.onepage which loads your default checkout.thankyou. On failture the customer is redirected back to shop.cart page.