Hot answers tagged

21

Let's say that you have the order id 10000015: So $orderId = '10000015'; $order = Mage::getModel('sales/order')->loadByIncrementId($orderId); $billingAddress = $order->getBillingAddress(); $shippingAddress = $order->getShippingAddress();


18

Thee address information is stored within the Mage_Customer_Model_Customer so you should be able to create an instance of it with the customer id. $customer = Mage::getModel('customer/customer')->load($customerId); Then depending on the type of address that you are looking for you should be able to call one of the following functions. Primary Billing ...


16

The address is not just on checkout page, but in profile too. Anyway, in admin panel go to System → Configuration → Customers → Customer Configuration open Name and Adress options and the is Number of Lines in a Street Address. Here you can set it.


16

Actually the variables defined at the top of the email are 'injected' when the template is called. In this case it's the order object. If you check out the file app/code/core/Mage/Sales/Model/Order.php you can find around the line 948 the method getShippingAddress. This is the actual function you're referencing here. Now for the format('html') part, this ...


14

/app/code/core/Mage/Sales/Model/Quote.php is the Quote class for the quote object /app/code/core/Mage/Sales/Model/Quote/Address.php is the Quote Address class for any quote address objects A quote object would normally contain 2 address objects, but can contain more if multiple delivery addresses are present. In regards to the 'collecttotals' method(s):...


14

Login into Magento Admin > STORES > Configuration > CUSTOMERS > Customer Configuration > Address Templates You also can find in the config xml: vendor/magento/module-customer/etc/config.xml [EDIT] We cannot use this config for billing and shipping format on checkout page. In this case, we need to check the format: -vendor/magento/module-checkout/view/...


13

I solved rewriting street on di.xml: ... <type name="Magento\Checkout\Block\Checkout\LayoutProcessor"> <plugin name="rewrite-street" type="Vendor\ModuelName\Model\Checkout\LayoutProcessorPlugin" sortOrder="10"/> </type> ... And my LayoutProcessorPlugin.php: <?php namespace Vendor\ModuleName\Model\Checkout; class ...


10

This can be easily achievable without removing from "directory_country_region" database table. Just you need to follow below steps: Override _getRegions($storeId) method of Mage_Directory_Helper_Data class. Assign the Region Codes which you want to exclude into an array i.e $excludeRegions variable. Add logic for skip above region codes from available ...


9

Thanks to Fabian Blechschmidt, I came up with the following that works for me (using the event customer_save_before): public function detectPwdChange(Varien_Event_Observer $observer) { $event = $observer->getEvent(); $customer = $event->getCustomer(); $postData = Mage::app()->getRequest()->getPost(); ...


9

Starting from Magento 2.1.4 release, the checkout configuration has additional Display Billing Address On option (Stores -> Configuration -> Checkout -> Checkout Options). It has two possible values: Payment Method - billing address is displayed per payment method Payment Page - billing address is displayed above payment methods The second option should ...


7

You may echo the actual error message on this file: vendor/magento/module-payment/view/frontend/templates/transparent/iframe.phtml if you did not extend the file yet or if you did you may edit this on app/design/[vendor]/[theme]/ go to line 42 and replace this message: $t('An error occurred on the server. Please try to place the order again.') with this ...


6

Usualy, unless data has changed on a model, calling save() on it will not cause the model to be re-saved. This must have been the assumption during implementing the logic this way. However, since the quote address model's method _beforeSave() sets the quote ID, the customer ID, plus possibly the customer address ID and the same_as_billing property via the ...


6

If you check the admin: System > Configuration > Customer Configuration > Address Templates You'll see various options (Text, HTML, PDF). You can change the formatting/order of the PDF addresses at the 'PDF' option: {{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend ...


6

It's possible via layout XML In your theme's local.xml, add the following lines (before </layout>): <customer_account_create> <reference name="customer_form_register"> <action method="setShowAddressFields"><value>1</value></action> </reference> </customer_account_create> If you don't have a ...


6

$countryId = 'US' //static set for example $regionName = 'Alaska' //static set for example /** @var \Magento\Directory\Model\Region $region */ $region = $this->regionFactory->create(); $region->loadByName($regionName, $countryId); // load region on the // basis of state name and country id $regionId = $region->getRegionId(); // obtain region_id ...


5

Have a look into the code. You can use the customer_save_after event and just check for /app/code/core/Mage/Customer/controllers/AccountController.php:724 $customer->setChangePassword(1); Maybe this value is reseted, then you have to use save_before, but I recommend to send the mail after the saving. So if this value is not readable in the after event,...


5

From Magento CE 1.7 you should go into System->Configuration->General->State Options; unselect Germany from countries list and set Display not required State to "No" If your version is older than 1.7 you need to use an extension, I used this one Remove/Disable or Change Displayed States and Regions


5

The cleanest way to do this is to add extra validation functions in the Onepage Controller, the shipping and billing actions. Take a look at this article by Inchoo on Magento validation. Also, if possible, add the validation to the javascript validation library so no form submit is required. This custom validation function could test the user submitted ...


5

This might be late but I think very short & sweet solution :- The file is this - app/code/core/Mage/Directory/Block/Data.php and the function is this - getCountryHtmlSelect If you want to remove the very top blank entry from country drop down....just put false in toOptionArray(false); Don't forget that you put this file in app/code/local/Mage this ...


5

It looks like you have modified the Address Templates and you put an invalid character in there. Go to System > Configuration > Customer Configuration > Address Templates and restore JavaScript Template to its default value: #{prefix} #{firstname} #{middlename} #{lastname} #{suffix}<br/>#{company}<br/># {street0}<br/>#{street1}&...


5

You will get all the customer address related attributes by calling below url : http://yourwebsite.com/index.php/rest//V1/attributeMetadata/customerAddress/ Method Name : GET Same way for Authorization Bearer youraccesstoken You will get the all the address related attributes name and its values like state , country etc. Their you will find ...


5

I found it myself. Here is the solution We have to override the payment.html in the checkout module. Copy this file; \magento\module-checkout\view\frontend\web\template\payment.html and place it in your custom theme (we have to create a custom theme for this) with the following structure; \your-theme\Magento_Checkout\web\template\payment.html In this ...


5

You can get the formatted address using address id with below code: public function __construct( \Magento\Customer\Api\AddressRepositoryInterface $addressRepository, \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Customer\Model\Address\Mapper $addressMapper, ) { $this->addressRepository = $addressRepository; $this->...


5

If you want to remove the Zip Code based on country selection, then firstly you can make zip code optional for this country from backend (i.e UAE), from store > config > general > Zip/Postal Code is Optional for and un-select your country which you want. then you can override below javascript in your custom module magento/module-ui/view/base/web/...


4

I wanted to do something similar, but I ended up with his code instead: I hooked onto controller_action_postdispatch_customer_account_resetpasswordpost function resetpasswordpost(Varien_Event_Observer $observer) { $customer_id = Mage::app()->getRequest()->getParam('id'); $customer = Mage::getModel('customer/customer')->load($customer_id); }...


4

Get shipping details by order id $order_id = 2314; //use your own order id $order = Mage::getModel("sales/order")->load($order_id); //load order by order id $shipping_address = $order->getShippingAddress(); echo $shipping_address->getTelephone(); echo $shipping_address->getPostcode(); //use print_r($shipping_address->getData()); to ...


4

The {{depend}} condition checks whether there is data for the variable to output. For instance: If the customer hasn't entered any prefix details then there will be no data in the database. The {{depend}} condition recognizes this and makes sure that in this case the prefix variable isn't displayed in the email template. To learn more about this click here ...


4

Try ->getPrimaryShippingAddress() or ->getPrimaryBillingAddress() on the getCustomer() and use ->getCompany()` for the data


4

That is definitely a kind of a bug-feature that was done by core team on purpose, but I don't think that it is done specifically for resetting an address. Might be it was a bug fix of filled in address fields on some blocks, before onepage template has been separated from multi shipping checkout. But the main point is that address is actually is not reset. ...


4

If you want disable Region from the address, you have to set below option like. State is Required for : remove all selected country from here. Allow to Choose State if It is Optional for Country : Set it as "No" You can also remove it from "add new address" in customer account. Copy file form vendor/magento/module-customer/view/frontend/templates/address/...


Only top voted, non community-wiki answers of a minimum length are eligible