fournier.yoan Posted April 30, 2014 Share Posted April 30, 2014 Bonjour, Je bloque sur un problème, je vous explique en faites, je vends des accessoires pour animaux, entre autres des graines et de grandes cages pour oiseaux pour oiseaux, ces fameux objets lourds et volumineux, je ne peux pas offrir les frais de port pour ces produits. Donc en faites j'ai bien défini le frais de port offert à partir de 100€ mais je voudrais faire quelques chose pour que si c'est des grandes cages ou des graines (+de 10kg) la gratuité ne soit pas pris en compte. Pour info sur chaque produit le poids et indiqué. Merci de votre aide ! Link to comment Share on other sites More sharing options...
Sab74 Posted April 30, 2014 Share Posted April 30, 2014 Bonjour Je pense que ça se passe dans le Cart.php dans la partie : // Free fees Mettre une condition du poids >10kg Link to comment Share on other sites More sharing options...
fournier.yoan Posted April 30, 2014 Author Share Posted April 30, 2014 D'accord, mais y a une variable qui existe correspondant au poids ? Link to comment Share on other sites More sharing options...
Kloan Posted April 30, 2014 Share Posted April 30, 2014 Bonjour, Vous pourriez peut-être paramétrer les frais de port au poids, avec une tranche plus de 10 kilos, port payant. Bien sûr si des clients ont l'habitude de vous achetez pour 10 kilos de graines ça ne résout pas votre problème. Link to comment Share on other sites More sharing options...
fournier.yoan Posted April 30, 2014 Author Share Posted April 30, 2014 Bonjour, Merci de votre réponse, mais j'ai déjà configuré par tranche de poids juste que comme j'ai configuré le fdp gratuit pour + de 100€ bah ça ne prend pas en compte, si la commande dépasse 100€ le fdp est offert. Link to comment Share on other sites More sharing options...
fournier.yoan Posted May 1, 2014 Author Share Posted May 1, 2014 up ? L'idée du fichier cart.php avec la condition me parait bonne, mais je n'arrive pas à le mettre en place.. Je ne connais pas du tout smarty et cette environnement me pertube un peu Link to comment Share on other sites More sharing options...
fournier.yoan Posted May 2, 2014 Author Share Posted May 2, 2014 // Free fees $free_fees_price = 0; if ($this->getTotalWeight() < 10) { if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE'], Currency::getCurrencyInstance((int)$this->id_currency)); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false); if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) { Cache::store($cache_id, $shipping_cost); return $shipping_cost; } if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) && $this->getTotalWeight() >= (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] && (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] > 0) { Cache::store($cache_id, $shipping_cost); return $shipping_cost; } // Get shipping cost using correct method if ($carrier->range_behavior) { // Get id zone if (isset($this->id_address_delivery) && $this->id_address_delivery && Customer::customerHasAddress($this->id_customer, $this->id_address_delivery)) $id_zone = Address::getZoneById((int)$this->id_address_delivery); else $id_zone = (int)$default_country->id_zone; $check_delivery_price_by_weight = Carrier::checkDeliveryPriceByWeight((int)$carrier->id, $this->getTotalWeight(), (int)$id_zone); // Code Review V&V TO FINISH $check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice( $carrier->id, $this->getOrderTotal( true, Cart::BOTH_WITHOUT_SHIPPING, $product_list ), $id_zone, (int)$this->id_currency ); if (( $carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT && !$check_delivery_price_by_weight ) || ( $carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE && !$check_delivery_price_by_price )) $shipping_cost += 0; else { if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT) $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone); else // by price $shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency); } } else { if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT) $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone); else $shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency); } // Adding handling charges if (isset($configuration['PS_SHIPPING_HANDLING']) && $carrier->shipping_handling) $shipping_cost += (float)$configuration['PS_SHIPPING_HANDLING']; // Additional Shipping Cost per product foreach ($products as $product) if (!$product['is_virtual']) $shipping_cost += $product['additional_shipping_cost'] * $product['cart_quantity']; $shipping_cost = Tools::convertPrice($shipping_cost, Currency::getCurrencyInstance((int)$this->id_currency)); //get external shipping cost from module if ($carrier->shipping_external) { $module_name = $carrier->external_module_name; $module = Module::getInstanceByName($module_name); if (Validate::isLoadedObject($module)) { if (array_key_exists('id_carrier', $module)) $module->id_carrier = $carrier->id; if ($carrier->need_range) if (method_exists($module, 'getPackageShippingCost')) $shipping_cost = $module->getPackageShippingCost($this, $shipping_cost, $products); else $shipping_cost = $module->getOrderShippingCost($this, $shipping_cost); else $shipping_cost = $module->getOrderShippingCostExternal($this); // Check if carrier is available if ($shipping_cost === false) { Cache::store($cache_id, false); return false; } } else { Cache::store($cache_id, false); return false; } } // Apply tax if ($use_tax && isset($carrier_tax)) $shipping_cost *= 1 + ($carrier_tax / 100); $shipping_cost = (float)Tools::ps_round((float)$shipping_cost, 2); Cache::store($cache_id, $shipping_cost); return $shipping_cost; } } Dans mon fichier cart.php section // free fees j'ai fais ça. Qu'est ce qui cloche ? Link to comment Share on other sites More sharing options...
Sab74 Posted May 5, 2014 Share Posted May 5, 2014 Je suppose que tu as dû faire des déclinaisons pour définir le prix des différentes tranches de poids pour les graines et de même pour les tailles des cages sur la fiche produit Tu devrais peut être récupérer les id des différentes déclinaisons et les mettre dans la condition avec" AND $id_product_attribute != (id des déclinaisons auxquelles tu ne veux pas de frais de port offerts)" à mettre à la suite de : if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0 AND et de même pour && (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] > 0 AND Link to comment Share on other sites More sharing options...
fournier.yoan Posted May 5, 2014 Author Share Posted May 5, 2014 J'ai résolu mon soucis en rajoutant à cette ligne : if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) && $this->getTotalWeight() >= (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] && (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] > 0) ceci : if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) && $this->getTotalWeight() >= (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] && (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] > 0 && $this->getTotalWeight() < 10) Merci quand même pour vos réponses Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now