Jump to content

Specific "Add-to-cart"


Recommended Posts

Hi guys =)

I'm doing a product page on which I need Add-to-cart buttons specific to each product. For the moment I use this stucture :

 

"http://yourdomainname/panier?add=1&id_product=productID"

 

It works well when you are not connected with any user account (it brings to your cart with the product inside, the redirection is not intentional, but it doesn't bother me)

Unfortunately, when you are conenct with an account, it redirects you on the homepage without even putting the product in your cart. 
 

Do somebody knows how to do that ? =)

Link to comment
Share on other sites

Can I for example put this in the controller of a page I create, to call it in my page ? =)

If I do so, must I use this kind of syntax ? :

"

public static function getCategoryName($id){
    $category = new Category ($id,Context::getContext()->language->id);
    return $category->name;
    }

"

Link to comment
Share on other sites

You can try, but I'm unsure whether it will work. I have gotten static functions in PrestaShop's core classes to work in Smarty, so hopefully your own class would work too. You'd use something like the following in your TPL file: {YourClass::getCategoryName($id)}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...