Magento - Hiding Options for guest checkout - php

How do I determine the checkout method selected at the billing stage?
We have a plugin that shows an option for a customer to select a customer group when checking out from our website.
The problem is we wish to hide this option if they want to checkout as a guest, so the option is only visible if they are registering or are logged in.
I tried to do this using the isCustomerLoggedIn() function but that then doesn't show the option when they have selected register.
Does anyone know of a way of telling in the persistent/checkout/onepage/billing.phtml template if a customer has selected register or guest checkout?
Thanks in advance!

I think, it'd have been better to have worded the question "How do I determine the checkout method selected at the billing stage?"
Anyway, you should be able to tell which checkout method was selected via
$this->getQuote()->getCheckoutMethod()
So:
if($this->getQuote()->getCheckoutMethod() == "register" ||
Mage::getSingleton('customer/session')->isLoggedIn() )
{
...

You should be able to tell which checkout method was selected via
$this->getQuote()->getCheckoutMethod()
So:
if($this->getQuote()->getCheckoutMethod() == "register" ||
Mage::getSingleton('customer/session')->isLoggedIn() )
{
...

Related

Change order in Woocommerce checkout

I need to change the layout of the Woocommerce checkout page. I need to move the payment option box along with the terms&conditions checkobox ABOVE the order-review table. The "Place Order" button should stay at the bottom though.
I know I need to override the template in my childtheme, but I just can't get this to work as the payment box is combined together with the order-review table. Or is this somehow possible via a function?
Thank you!

magento onepage checkout manage fields

I want to show FAX field at every checkout. Right now in magento 1.9.1 there is a functionality that if you are existing user and you are giving order two or more times then it doesn't ask you to enter address everytime but it will auto fill it from database. But I want that FAX fields should always be visible to user and if he enters value then store it otherwise it should store NULL value.
Thanks in advance.
You can add field in checkout look field add in checkout.
In this link you will find jobtitle added in checkout you need to replace "job title" with "FAX".
Magento should have a fax functionality under the customer address object.
https://www.mymagento.com/index.php/admin/customer_address_attribute/
Either enable it and toggle it to required or duplicate the phone field and set it to be fax. You may need to tweak it as desired in the frontend template used: ( vanilla: app\design\frontend\base\default\template\checkout\onepage\shipping.phtml )
If you're looking to force confirmation on an existing customer address entry (fax) there may be a more extensive customization you need to do.
I would explore your onepagecheckout controller that is currently used ( vanilla: app\code\core\Mage\Checkout\controllers\OnepageController.php ) to see if any other customizations/validation is needed.

Add register option on virtuemart Checkout

I have a site and I use Virtuemart on it. When user goes to checkout, there is a login form (I am already a member), but there is no any register option or button. How can I add the registration option on the checkout page?
The form is above the billing and shipping adress information.
Thank you
The url is
index.php?option=com_users&view=registration
but you may want to create a menu item (in a hidden menu) pointing to it in order to get a proper SEF url.
Then you just insert a link in your code (template override of the login module would be the easiest, just lookup "Joomla template override" here on StackOverflow.
YOUR_JOOMLA_FOLDER/components/com_virtuemart/views/cart/tmpl/default.php

Ability to pass variables through add to cart url and query them at time of checkout?

I've been having difficulty trying to accomplish the passing of variables that a user inputs from within the product page into the cart so that when the user checks out I can utilize that data.
I'm confused on whether I should be using custom fields / variables / or some other means to make this work. I'll try to describe the exact workflow before so my use case is clear.
1) User lands on a specific simple product page
2) Before the user can click the add to cart button, they must validate their account credentials from my auth server that is decoupled from wordpress.
3) Once the details are validated the user can click add to cart and the product in the cart would have the user details attached to it in some form for querying at checkout.
4) * At this point user interaction is done
5) * At time of checkout I've hooked add_action( 'woocommerce_order_status_completed', 'order_system' ); to inspect the cart and the items within the cart
6) * *I need to retrieve the variables that were passed along with the item **
7) ** My checkout hook then POSTs the referenced variables to an API **
Any help is greatly appreciated, I've struggled with this for some time now.
This guide I wrote is probably perfect for what you need. This plugin is different, but it should have all of the hooks and info you need to modify it for your own needs.
I show all of the steps on adding a custom form and adding the values the user enters to the cart meta so you can query it out during the checkout process.
function is_xaik_wc_in_cart() {
global $woocommerce;
if (sizeof($woocommerce->cart->get_cart())>0) :
foreach ($woocommerce->cart->get_cart() as $item_id => $values) :
if (isset($values['_xatik_wc_data'])) :
return TRUE;
endif;
endforeach;
endif;
return FALSE;
}
Once you know it's in the cart, you can just query it doing another foreach loop on the cart. Or just modify the function to do it all at once.
All of these variables should stick with the cart meta information.
Here is a gist example that should work.
On a shopping cart your main objective is to make the shopping as easy as possible, so you should NOT use java script variables or custom hidden fields (i am assuming you were talking about these), if you do so those variables will be lost if the user exit of your website or he just hit back after adding something to the car.
Try using cookies or sessions.
You can find information about cookies Here

Adding newsletter checkbox to Magento (1.4.1.1) one page checkout

I've taken over an old project from a developer that just left and I could use some help just getting this done.
What I'm trying to do:
Magento (1.4.1.1) with one page checkout, I need to add a newsletter subscribe checkbox that if it is checked will subscribe the customer guest, registered or otherwise to the newsletter.
What I've done:
I've got a checkbox in the billing stage and I have got got a module that works by observing the event checkout_type_onepage_save_order and from that I subscribe the customer like so:
public function list_subscribe(Varien_Event_Observer $observer)
{
$quote = $observer->getEvent()->getQuote();
$customer = $quote->getCustomer();
if (($customer instanceof Mage_Customer_Model_Customer))
{
Mage::getModel('newsletter/subscriber')->subscribeCustomer($customer);
}
else
{
Mage::getModel('newsletter/subscriber')->subscribe($email);
}
}
That works fine but it subscribes everybody that visits the checkout and I need to somehow check that the checkbox is ticked in the checkout process. This is the part that has got me confused. I'm very new to Magento and just need to get this done so hoping a nice person out there can help me lean how would I go about doing this apparently simple check for a ticked checkbox?
Many thanks in advance for any contributions.
This extension work for your requirement, if you want to add module, here is the link http://www.emthemes.com/em-newsletter-optin.html
there are many extension for doing this and its free of cost

Categories