I'm fairly new to Magento and am setting up a new theme from scratch. I'm not using any of the standard Magento JS files until now and I've included jQuery and a js file for custom scripts.
Now I'm looking into recreating the Add To Cart functionality but standard wise this seems to call some js function which I do not have declared now (lacking the Magento JS files). I'd like to set it up on my own with an ordinary form submit.
Can anyone give me an example of how to execute the Add To Cart command for the product I'm currently viewing? Without the necessity of standard Magento JS files?
What Magento do for add to cart is it calls productAddToCartForm.submit function of javascript to validate all required field and if true then it submit product form.
So you can call your javascript method for form submit and add to cart.
Add to cart button comes from this file, so you can change onclick event here.
app\design\frontend\base\default\template\catalog\product\view\addtocart.phtml
Related
I am trying to add new Ajax areas in cart page. see the image below. i want to put an input that will refresh when i increment the quantity of a product and show the number of the product inside the cart.
Please help!!!
This is possible, you have to use the Prestashop hooks.
You can add data to the hooks using modules.
Available hooks on the shopping-cart page
displayCrossSellingShoppingCart
displayShoppingCart
displayShoppingCartFooter
You can find all available hooks here: Prestashop 1.7 - List of module hooks
You can find more information on how to use hooks here Prestashop 1.7 - Usage of hooks
I have a website here that I need to create a custom page where in I can call the header and the footer as well as the sidebar.
If you're going to do it in Wordpress its easy as this link says:
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
However, Joomla is a bit different on this one. If I will try to add a new article I wont be able to customize the layout that I want. Let's say in the custom page I want to create I don't want the footer to show up and I want to add internal CSS on it which is possible on Wordpress custom page.
Any idea how do the same thing Joomla 1.5??
Thanks!
I am trying to create a landing page for our company which runs on Magento Enterprise Edition 1.13. We use CMS pages for our landing pages and in the past we have been able to create custom add-to-cart buttons directly on the CMS page. It was very simple in fact, we would create a button and send the button to this URL endpoint:
<button class="button btn-cart" title="Add to Cart" onclick="setLocation('/n/magento/checkout/cart/add/product/644/qty/1')" type="button"><span><span>Add to Cart</span></span></button>
It was nice and simple and allowed us to really engage our visitors with awesome landing pages and the ability to add products to cart without leaving this highly optimized page.
You can read a StackOverflow post about the OLD way to do it here: Placing "Add to cart" button on homepage in Magento
However, this no longer works in Magento EE 1.13 according to Magento themselves.
I contacted our Magento support and explained to me that the syntax had changed, now requiring you to put your security hash in the URL. This seemed like a security concern to me, so I questioned it. I was then responded to stating that the security flaw was added to prevent developers from using this anymore without compromising their site. Essentially they are discouraging use of this. They said:
My developer indicated that the ability to add a product to the cart via a direct URL wasn't an intended functionality in Magento, and so the addition of the form_key value was meant to prevent its further use with the upgrade to 1.13.
So my question for all of you, is that if somoene wanted to create add-to-cart buttons on a CMS page, in order to add products without needing to send someone to a product page (where they would no longer be on our optimized landing page), how would I go about doing this?
Is there a way in Magento 1.13 to add a product to cart with a custom button that could be placed in custom HTML within a CMS page? Can this be done with a static block or widget? We really relied on this feature and are now questioning the purpose of Magento EE's $18K a year pricetag with this feature taken away. Please help, thanks!
You'll want to include the formkey block, and then use JavaScript to pull the value from the <input /> tag that is generated and add it to your link URLs, AJAX, etc.
{{block type="core/template" name="formkey" template="core/formkey.phtml"}}
This will work in 1.13:
<button onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1'">Add To Cart</button>
There is a way to modify magento code to allow adding products to shopping cart without form key.
I will post the solution, but anyway I want to warn you that removing form key validation will enable CSRF attacks on your customers!
You need to edit app\code\core\Mage\Checkout\controllers\CartController.php
Find next piece of code:
public function addAction()
{
if (!$this->_validateFormKey()) {
$this->_goBack();
return;
}
Comment first 3 lines of this function:
public function addAction()
{
//if (!$this->_validateFormKey()) {
// $this->_goBack();
// return;
//}
Now it is possible to use static links.
Is there any possible solution to develop this http://www.tailorstore.co.uk/tailor-made-shirts
kind of functionality in joomla virtuemart like any component or module available for this attributes ?
There is any possible solution with Joomla. Simply create a component that has the buttons and javascript to edit the image on the page you've shown there - and pass it all across into a virtuemart cart.
In terms of clicking on a button and changing the image - this is pretty basic javascript. See this How to add product to virtuemart Cart without saving to darabase? About adding a product into the virtuemart cart outside of virtuemart
Or use a simple shopping cart module like this: http://extensions.joomla.org/extensions/e-commerce/shopping-cart/10116
In terms of an existing component changing the images like on your site the answer is no it almost certainly doesn't exist - but that's the beauty of Joomla - being able to build it easily.
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.