Check condition when Add to car Button is clicked Prestashop - prestashop

In my Prestashop web there are 3 types of products (In stock, On demand and Coming soon). When a user clicks on Add to cart button in product page, it should shows an alert saying the products cannot be mixed (you cannot buy a product in stock and a product on demand). I use BlockCart module but I cant find the file which I have to edit. Also, I have looked in CartController or ProductController but nothing.
Can you help me?

You Can check in controllers/front/CartController.php for processChangeProductInCart Function.

Related

BigCommerce 404 error when I try to access product that is "not visible" on the Storefront

I currently have a few products that are "not visible" on the storefront. I don't want the products to be showcased (appear on the landing page or in the "see all products" page, but I would like to have it be visible when users try to access it directly, for example if a friend shares a link of that product.
But currently when I try to share the link to a product that is "not visible" to my friend, he gets a 404 page not found error, I would like for him to see the product, even though it is not publicly visible, any idea how I achieve this?
When a product is set to be not visible, it will not show for anyone (except for those logged in to the admin panel) on the front end. You can try appending the query string "?showHidden=true" to the end of the URL you are sending your friends. This may allow them to view the product.
Otherwise, you would need to make the product visible and write some custom code to hide it from the general users, or use customer group visibility settings.
Edit to describe the process of using customer groups:
The simplest approach here might be the following:
Have your friend create a customer account on your store.
Assign them to a new customer group (see documentation here).
Add your hidden product to a new category.
Make sure the custom customer group has visibility to all categories, while the default customer group has access to select categories (check all except the new category with the hidden product)
As long as your friend is logged in to their customer account, they should be able to see the product, while your normal shoppers cannot! The one major downside to this is if you make any new categories, they will not automatically be visible to your default customer group, and you will have to manually add the visibility.

OroCommerce: Configurable Product display in storefront and backoffice

I've created configurable product (internet connection with different speed) following docs, in storefront I see dropdown with product vairants, all is ok.
But in backoffice (when editing shoppingList or creating order) there is always only one variant of product with no ability to quickly select another option (eg change speed to another one) - is this how oro backoffice works and nothing could be changed to make backoffice user quickly navigate between product variants (eg change speed from 1M to 2M by clients phone request)?
Cant even edit product in shopping list
UPD:
If there's no way to see user-friendly configurable product in backoffice than I need to implement smth like button near each product in LineItem which will show popup with product variants. When user will select another option request will be sent to some route and it will run smth like $lineItem->setProduct($newProduct); , grid reloaded and new product variant selected. Is it ok or it will break something in oro?
Where to start for adding that button and popup? Eg I cant edit oro shopping list template, how to properly extend it?
On the line item editing form you cannot change the product, no matter it's configurable or simple. It's done intentionally.
If you want to change the product, you always can remove a line item and add the new one with updated options manually:

PrestaShop Add To Cart button not working from single product page

Whenever the client clicks on the "Add To Cart" button from single product page, it simply goes to cart but cart items are not updated. It redirects to this URL /?controller=cart where all items added either from category view or grid view are there but not the one added from single product page.
I just need a hint on what might be the issue. I'm using Prestashop version 1.7.
Thanks!
It is most likely a JS error; open the browser's dev tools -> console and check the errors, you will notice them they're red.

add custom value to cart from a form, prestashop

I'm creating a simple Prestashop module that places a form in CMS pages. That form will return a custom value (and a new product) that I need to be redirected to the cart after clicking a "submit" button.
How can I send the data to the cart?
Thank you!
Rui
Every customer has a unique cart ID.
1 ) After submit put information to mysql table
2 ) hook module to cart step
3 ) Check if this customer and cart id equal and do what you need to do.
I think its easiest and simplest way to do it. Rather than override system files. Even more you talking about module.
There is a javascript class in prestashop to control the cart.
Simply call ajaxCart.add(params)
This function will add the product to the cart with ajax.

Prestashop : Adding a field to choose Shipping carrier in product page front office

I'm using PrestaShop 1.5.5.0.
I want to add a custom check box list to the product page so a customer can choose shipping carrier on the product details page. Can it be possible ? I can add a specific fields in the product details page. As I'm new it's little difficult for me to figure out how can I add other details and carry the values to the order page and that is also dynamically. Is there any module available by which I can accomplish the task ? Please suggest me.
What I want to do is this : Choosing shipping carrier in product page :
http://www.wayfair.com/LifeStyle-Solutions-Zurich-Platform-Bed-LS3-ZUR-X-CP-LF1087.html
Well It's a tough task. You need to work on the controller if you want to carry the values or create a module like shipping estimate and hook it to the product page that might work.