Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Как сгделать автоматическое добавление товаров в корзину opencart 3?


MACTEP_FIDE
 Share

Recommended Posts

Как сгделать автоматическое добавление товаров в корзину opencart 3? Есть код от 2 опенкари, но на 3 версии, он к сожнонию не рилииет. Помогите его поправить на 3 версию. Буду очень благодарен. Очень прошу вот этот код нужен для 3 версии опенкари. Люди не проходите мимо, пожалуйси! Вот код

//// add
    $needed_products=array(47,28);///Через запятую ID нужных товаров
     
    ////
////add
        $cart_products = array();
        foreach ($this->session->data['cart'] as $key => $quantity) {
          $product = explode(':', $key);
          $cart_products[] = $product[0];
        }
        foreach($needed_products as $needed_product){
          if(!in_array($needed_product, $cart_products)){
            $this->cart->add($needed_product, 1, array());// Перебираем наши товары и добавляем в корзину, если товара еещё им нет. Добавляем 1 ед. товара без опций.
          }
        }
        /////
Link to comment
Share on other sites


  • 2 weeks later...

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
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.