Im trying to overload my CartCotroller so create folder structure like my CartController in the local:
app/code/local/Mage/Checkout/controllers/CartController.php
My question is, does magento execute this Controller and ignore the one whose in the core?
Cause what im trying to do is, i want to add an condition when the customer post a coupon code without changing my form method value. Is it possible?
Yes, Magento will execute the controller placed in app/code/local instead of the core file. An even better way to implement new code or extend the core is to create your own module. So you'd have all your custom code in one place and it's maintanable should you update Magento.
Smashing Magazine gives a nice basic roundup on how to accomplish this. http://coding.smashingmagazine.com/2012/03/01/basics-creating-magento-module/
Related
I am starting in the Magento development world, and I'm creating a new theme.
On my theme, I have a block which displays business contact info, but I don't know how to get the data from the store.
I have to make a custom menu as well, but stop in the same problem: getting category data from the store.
I also wanted to know if there is any place where you can find more references on this data return issue, such as what available methods and classes are available, for example.
Where do you want to display the custom data ? In a product page or your custom module's separate page ?
If you want to use custom block in sidebar you can follow steps given here
https://aureatelabs.com/magento-2/how-to-add-a-static-block-in-a-sidebar-column-magento-2/.
Here are some ref you can use:
https://itectec.com/magento/magento-magento-2-get-custom-module-data-in-theme-phtml/
https://code.vky.co.in/display-custom-module-collection-data-frontend-magento-2/
I'm new to Magento, so forgive my lack of knowledge. I am following a tutorial to integrate the contacts in Magento and import it to SugarCRM. The tutorial changes the core functions of Magento, but I would like to write a module and leave the core intact. I can easily find information about overriding controllers, models, helper, etc. But I have a question.
Imagining, for example, each time a user registers on my website, his contact information is exported to SugarCRM. In the save contact phase, in my module I know that I can write a specific code and tell that it would need to be run after or before some specific core-functions of Magento are done to save the contacts.What I really don't understand is, how will Magento know that I have a module that will perform me certain actions when I'm creating a new account?
The way magento handle this is by using events/observers. For instance, if you needed to send order information to another system after an order has been placed, you could create a custom module which observe sales_order_place_after.
Read more # http://codemagento.com/2011/04/observers-and-dispatching-events/
To get a list of events see https://magento.stackexchange.com/questions/153/where-can-i-find-a-complete-list-of-magento-events
For how to create an module with observer see https://stackoverflow.com/a/12696681/1191288
I installed an extension to add custom fields to customer registration form.I want to add some option value in dropdown menu box of input validation in backend admin page..could you plz tell me the path of the folder where can I find the phtml file which is responsible for that part ?
-Thanks.
The files you are looking for are in:
app/design/adminhtml/default/default/template
But just changing the .phtml file won't do the job. The customer model itself should be extended to provide for your extra field. Therefore i highly recommend you to write a module for this instead of altering Magento core code. This to make sure that you can still use updates in the future.
Writing such an module requires more in depth knowledge of Magento. For more information on custom adminhtml see here.
For information on extending the core functionality look here.
If you don't feel like programming this all yourself take a look at customer attribute modules on Magento Connect.
inside the checkout onepage billing.phtml I have to do several checks and even remove or add stuff to the cart.
But I don't seem to find how to do that
how can I change the cart from within an template?
Thanks,
Joe
I would recommend that you don't apply these logic changes in the phtml. You should try to work with the Shipping or Payment method PHP code, either by extending Magento's core methods or writing your own. There are numerous tutorials on the Magento wiki or other blogs on how to achieve this.
By editing the phtml directly, you run the risk of breaking when Magento releases patches or upgrades, and it is bad practice in general.
From that file you can use $this->getQuote() to get a Mage_Sales_Model_Quote object. Methods you might find useful on that object are getAllItems(), addItem() and removeItem().
I’m having a lot of trouble understanding how to create a module that will add an extra button to the shopping cart page. I found lots of info on payment modules and stand-a-lone page modules, but nothing for this.
I simply need to add a button underneath the regular “Checkout” button that can post item data to another website. I’ve created a module but can’t get Magento to recognize it and display the button on that spot. Any help would be greatly appreciated, even just sending me to an existing tutorial that I haven’t been able to find. Thanks.
A custom module is probably overkill for this. Module means a very specific thing in Magento. It's a mechanism for inserting custom code into Magento's standard operations. All you want to do is add a button to the cart page. Editing the file at
./base/default/template/checkout/cart.phtml
(substitute your theme/site name if not using base or default)
is the place you'll want to start looking. Just find the phtml file that corresponds to the place you want to insert your custom HTML and have at it.