Jump to content

How to get virtual product in the cart for use in Address.php?


trace

Recommended Posts

i'm not sure what you mean by "address1", however Prestashop is designed to require a billing address.  A shipping address is not required if the cart only contains virtual products.

Thank you for your reply. I need an "address1" is required for everywhere. But if cart with only virtual products, this field need to be not required.

Link to comment
Share on other sites

Delivery address.

I'm more interested in how to get data from the shopping cart. If virtual cart (only virtual products in cart) do something, else - do something.
 

How to do something like this:

                if (in_array('address1', $arr) && $is_virtual) {
                    $this->def['fields']['address1']['required'] = 0;
                } else if (in_array('address1', $arr) && !$is_virtual) {
                    $this->def['fields']['address1']['required'] = 1;
                    $this->fieldsRequired[] = 'address1';
                } else {
                    $this->def['fields']['address1']['required'] = 0;
                }
Edited by trace (see edit history)
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...