Jump to content

zorrobsas

Members
  • Posts

    7
  • Joined

  • Last visited

About zorrobsas

  • Birthday 03/31/1982

Profile Information

  • First Name
    mariano
  • Last Name
    brizuela

zorrobsas's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Buenos, En si no era un error sino un funcionamiento de prestashop. Al momento de agregar al carro. se llama desde CartController a if ($this->id_product_attribute) { if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check)) { $this->errors[] = $this->trans('There are not enough products in stock', array(), 'Shop.Notifications.Error'); } } elseif (!$product->checkQty($qty_to_check)) { $this->errors[] = $this->trans('There are not enough products in stock', array(), 'Shop.Notifications.Error'); } la funcion para Null ya que el id Atributo hace referencia al idProducto. public static function checkAttributeQty($idProductAttribute, $qty, Shop $shop = null) { if (!$shop) { $shop = Context::getContext()->shop; } $result = StockAvailable::getQuantityAvailableByProduct(null, (int) $idProductAttribute, $shop->id); return ($result && $qty <= $result); } En mi caso como consumo un webservice externo y me manejo solo con ID me terminaba retornando Error y no me agregaba nada al carro. Espero que se entienda. SAludos
  2. Hi, I found the error. It did not work for me in one of the loop that calls the function for idproduct at zero. Who can help me? class StockAvailable extends StockAvailableCore { public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) { PrestaShopLogger::addLog(' Class over', 1, null, 'over', (int)$id_product, true); return 1000; } } Hi, I found the error. It did not work for me in one of the loop that calls the function for idproduct at zero. Who can help me?
  3. hola Javier, el error se daba porque a la función al momento de hacer el add_to_cart en una de todas las pasadas que hace por la función pasa idProduct = 0. El problema ahora es que no encuentro de donde hace el llamado para que le pase un idproduct vacio/nulo/cero. Acote la clase para hacer la prueba class StockAvailable extends StockAvailableCore { public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) { PrestaShopLogger::addLog(' Pasa por clase over', 1, null, 'over', (int)$id_product, true); return 1000; } }
  4. hola, necesito cambiar el origen de donde obtengo el stock disponible. Lo que hice fue hacer un override de StockAvailable. El stock me lo retonar en la ficha del producto sin problemas, el inconveniente que tengo es que una vez que obtiene el stock con mi función modificada. Me deja de funcionar el añadir el producto al carrito. La verdad que he estado buscando, y no se en que estoy fallando. Alguien me puede decir que se ejecuta al momento de hacer el click en el add-to-cart ? class StockAvailable extends StockAvailableCore { public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) { .... $ch=curl_init($url); .... $stock = json_decode($ch); $cantidadStock = (int)$stock->stock; curl_close($ch); ... return $cantidadStock; }
  5. Hi, I'm having problems with the override of stockAvailable function getQuantityAvailableByProduct. I take quantity from a webservice, the GET it done correctly and I see the quantity in the product but when I clickt in add to cart Nothing happens. I know I'm killing something but I do not know it's class StockAvailable extends StockAvailableCore { public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) { .... $ch=curl_init($url); .... $stock = json_decode($ch); $cantidadStock = (int)$stock->stock; curl_close($ch); ... return $cantidadStock; } }
×
×
  • Create New...