I have encounter a slight problem regarding magento checkout process. Currently I am using the list.phtml file to add orders into the cart, and upon changing the product, the cart is emptied and the newly selected product is added. I do this via this functionality:
this is the form for deleting (i have the form key into it)
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="POST" name="emptyTheCart">
<?php echo $this->getBlockHtml('formkey'); ?>
<button type="submit" name="update_cart_action" value="empty_cart" style="display:none" title="<?php echo $this->__('Empty Cart'); ?>" id="empty_cart_button"></button>
</form>
$('.item').click(function() {
$(this).find('input:radio')[0].checked = true;
var formurl = $(this).find('input:radio').val();
var datafile=$("#product_addtocart_form").serialize();
var dataExecURL = "<?php echo $this->getUrl('checkout/cart/updatePost') ?>";
var datafiles=$("#emptyTheCart").serialize();
datafiles = datafiles + "&update_cart_action=empty_cart";
$.ajax({
type : 'POST',
data : datafiles,
url : dataExecURL,
success: function()
{
$.ajax({
type : 'POST',
data : datafile,
url : formurl
});
}
});
});
This part works very good. The thing is that on the Category page i have the following custom design in the Custom Layout Update:
<block type="cms/block" name="opdracht_text" before="-">
<action method="setBlockId"><block_id>opdracht_text</block_id></action>
</block>
<block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml" >
<block type="cms/block" name=" shipping_method" >
<action method="setBlockId"><block_id> shipping_method </block_id></action>
</block>
<block type="checkout/onepage_shipping_method_available" template="checkout/onepage/shipping_method/available.phtml"/>
<block type="cms/block" name="billing" >
<action method="setBlockId"><block_id>billing</block_id></action>
</block>
<block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/billing.phtml"/>
<block type="cms/block" name="opdracht-delivery" >
<action method="setBlockId"><block_id>opdracht-delivery</block_id></action>
</block>
<block type="cms/block" name="payment_method" >
<action method="setBlockId"><block_id> payment_method </block_id></action>
</block>
<block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="checkout/onepage/payment.phtml">
<block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="checkout/onepage/payment/info.phtml">
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
</block>
<block type="core/template" name="checkout.onepage.payment.additional" as="additional" />
<block type="core/template" name="checkout.onepage.payment.methods_additional" as="methods_additional" />
</block>
</reference>
As a onepage checkout functionality I have added to magento the extension from
http://www.magentocommerce.com/magento-connect/one-page-checkout.html
when I navigate to my store_url/chekout/cart I can clearely see the cart and the shipping methods and update the price there and after that proceed to the checkout page at
store_url/ onepage/
where I have my billing + shipping + payment methods
I have taken the blocks from the checkout.xml file from the layout folder from my template (default rwd template) and added them to the category page
The main issue that I am having is the fact that upon opening the page I cannot view the shipping method until after I have selected a product and refreshed the page. The State/Province Field is not shown at all and also the Payment methods do not show up.
The thing that I am currently trying to accomplish is that the checkout forms to be on the product page like in the following flow:
Product Selection -> Shipping Method -> Billing Method -> Payment Method
These are the steps that I am currently trying to put in one single page ( the product display page / category page )
I have managed to find the best solutin in this case by using the default xml for the magento iwd one page chekout.
in case you want to have the checkout page on the same page as the product page, in Catalog->Manage Categories, select your category, then on the Display Settings choose the Static Blocks and products option.
In the custom Design tab, set the page layout to no layout and then use the wrapper block and the desired blocks that you want on the page.
Also, do not forget to include the javascript files on the page.
Example for One page checkout with product list on the same page:
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/iwd/opc/checkout.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/iwd/opc/extend.js</name></action>
<action method="addJs"><file>mage/directpost.js</file></action>
<action method="addItem"><type>skin_js</type><name>js/opcheckout.js</name></action>
<action method="addItem" ifconfig="opc/paypal/status"><type>skin_js</type><name>js/iwd/opc/lipp.js</name></action>
<action method="addJs" ifconfig="payment/braintree/active"><file>braintree/braintree-1.3.4.js</file></action>
<action method="addCss" ifconfig="payment/braintree/active"><stylesheet>braintree/css/braintree.css</stylesheet></action>
</reference>
<reference name="content">
<!-- Auguria Insurance -->
<block type="opc/wrapper" name="es.checkout.container" template="opc/wrapper.phtml">
<!-- SHIPPING METHODS FORM -->
<block type="checkout/onepage_shipping_method" name="checkout.onepage.shipping_method" as="shipping_method" template="opc/onepage/shipping_method.phtml">
<block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="checkout/onepage/shipping_method/available.phtml"/>
<block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="checkout/onepage/shipping_method/additional.phtml"/>
</block>
<!-- Guest -->
<!-- BILLING FORM -->
<block type="opc/onepage_billing" name="checkout.onepage.billing" as="billing" template="opc/onepage/billing.phtml"/>
<!-- SHIPPING FORM -->
<block type="opc/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="opc/onepage/shipping.phtml"/>
<!-- COMMENT FORM -->
<block type="opc/onepage_comment" name="checkout.order.comment" as="customer.comment" />
<!-- PAYMENTS METHOD FORM -->
<block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="opc/onepage/payment.phtml">
<block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="checkout/onepage/payment/methods.phtml">
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
</block>
</block>
<block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="opc/onepage/agreements.phtml"/>
<block type="opc/onepage_subscribed" template="opc/onepage/review/subscribed.phtml" name="opc.newsletters" />
</block>
</reference>