Sign in to follow this  
Followers 0

Promotion par catégorie

11 posts in this topic

Posted · Report post

Bonjour,

Ce message s'adresse surtout à l'équipe PEEL .

Dans la v5.3 il y a la possibilité de mettre une promo en % par catégorie.

Dans la v5.2 il y a un champ "promotion" qui existe dans la table catégorie. Cela veux dire que c'était sur le point d'être activé ;-)

Avez vous le code à insérer pour que cela soit actif ? parce que avec les soldes en ce moment ce serait très utile.

Merci

Share this post


: post
Share on other sites

Posted · Report post

Bonjour,

Ce message s'adresse surtout à l'équipe PEEL .

Dans la v5.3 il y a la possibilité de mettre une promo en % par catégorie.

Dans la v5.2 il y a un champ "promotion" qui existe dans la table catégorie. Cela veux dire que c'était sur le point d'être activé ;-)

Avez vous le code à insérer pour que cela soit actif ? parce que avec les soldes en ce moment ce serait très utile.

Merci

Il faut modifier la classe caddie pour cela, ce qui n'est pas par défault dans la version 5.2

je vous laisse intégrer le code

function ajout(&$produitid, $quantite, $cId, $sId, $email_check, $liste_attribut) {


	global $taux_tva1, $taux_tva2, $taux_tva3, $module_lot;


			$this->articles[] 	= $produitid;

			$this->quantite[] 	= $quantite;

			$this->couleurId[] 	= $cId;

			$this->tailleId[] 	= $sId;

			$this->email_check[] = $email_check;


			$this->id_attribut[] = $liste_attribut;


			/* Traitement des attributs */

			$attributs = "";


			$total_prix_attributs = 0;


			if ($liste_attribut != "") {


			$tableau_attribut = explode("-", $liste_attribut);


			foreach($tableau_attribut as $tableau_id) {


				$tableau_attribut_id =explode("|", $tableau_id);


				$requete1 = "SELECT nom_".$_SESSION['langue']." as nom FROM peel_nom_attributs WHERE id = '".intval($tableau_attribut_id[0])."'";


				$query1 = mysql_query($requete1);


					if (mysql_num_rows($query1) > 0) {


						$obj1 = mysql_fetch_object($query1);


						$nom_attribut = html_entity_decode($obj1->nom);


					}


				$requete2 = "SELECT prix, descriptif_".$_SESSION['langue']." as descriptif FROM peel_attributs WHERE id = '".intval($tableau_attribut_id[1])."'";


				$query2 = mysql_query($requete2);


					if (mysql_num_rows($query2) > 0) {


						$obj2 = mysql_fetch_object($query2);


						$desc_attribut = html_entity_decode($obj2->descriptif);


						$total_prix_attributs += $obj2->prix;


					}


				$attributs .= $nom_attribut." : ".$desc_attribut."<br />";


			}


			}


			$this->total_prix_attribut[] = $total_prix_attributs;


			$this->attribut[] = $attributs;


			/* Fin du traitement des attributs */



			$sql = "SELECT e.prix_ttc AS ecotaxe_ttc, e.prix_ht AS ecotaxe_ht, p.on_stock, p.tva, p.poids, p.promotion, p.delai_stock, p.prix / (1+p.tva/100) as prix_ht, p.prix_revendeur / (1+p.tva/100) as prix_revendeur_ht, p.points, p.on_flash, p.prix_flash, p.prix_flash / (1+p.tva/100) as prix_flash_ht

			FROM peel_produits p  

			LEFT JOIN peel_ecotaxes e ON (p.id_ecotaxe = e.id) 

			WHERE p.id = '".intval($produitid)."'";


			$query = mysql_query($sql);


			$prod = mysql_fetch_array($query);


			$this->delai_stock[] = $prod['delai_stock'];


			$this->etat_stock[] = $prod['on_stock'];


			$this->points[] = $prod['points'] * $quantite; // Total points de la ligne


			$tva_percent = ($this->zoneTva == 1) ? $prod['tva'] : 0; # Si la zone de TVA est active


			$this->tva_percent[] = $tva_percent; # Si la zone de TVA est active


			$this->couleur[] = recupere_couleur($cId);


			$tableau_taille = recupere_taille($sId);


			$taille = explode("|",$tableau_taille);


			$this->taille[] = $taille[1];


			$total_prix_attributs_ht = $total_prix_attributs / (1+$prod['tva']/100);


			$option_ht = $taille[0] / (1+$prod['tva']/100);


			$poids_taille = $taille[2];


			$this->poids[] = ($prod['poids']+$poids_taille) * $quantite; // Total poids de la ligne


			$this->option_ht[] = $option_ht;


			$this->option[] = $option_ht * (1+$tva_percent/100);


			$this->ecotaxe_ht[] = $prod['ecotaxe_ht'];


			$this->ecotaxe_ttc[] = $prod['ecotaxe_ht'] * (1+$tva_percent/100);


			// Calcul du prix


			$this->percent_remise_produit[] = $prod['promotion'];


			// Récupération de la promotion par catégorie


			$query_cat = mysql_query("SELECT c.promotion FROM peel_categories c, peel_produits_categories pc WHERE pc.produit_id = '$produitid' AND c.id = pc.categorie_id");


			$cat = mysql_fetch_array($query_cat);


			$this->percent_remise_categorie[] = $cat['promotion'];


			if ($prod['on_flash'] == 0) {


			$prix_cat_ht = (isset($_SESSION['utilisateur']['priv']) && $_SESSION['utilisateur']['priv'] == "reve") ? $prod['prix_revendeur_ht'] : $prod['prix_ht'];


			} else {


			$prix_cat_ht =  $prod['prix_flash_ht'];


			}


			if ($module_lot == 1) { /* Si le module de gestion des prix / quantité est actif */


				$sqlQte = "SELECT quantite, prix, prix_revendeur FROM peel_quantites WHERE produit_id = '".intval($produitid)."' ORDER BY quantite";


				$resQte = mysql_query($sqlQte) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());


				if (mysql_num_rows($resQte) > 0) { /* Si il existe des remises / quantité dans la base */


					while ($Qte = mysql_fetch_array($resQte)) {


						if ($quantite >= $Qte['quantite']) {


						$prix_cat_ht = (isset($_SESSION['utilisateur']['priv']) && $_SESSION['utilisateur']['priv'] == "reve") ? $Qte['prix_revendeur'] / (1+$tva_percent/100) : $Qte['prix'] / (1+$tva_percent/100);


					}


				}


			}


			}


			$this->prix_cat_ht[] = $prix_cat_ht + $prod['ecotaxe_ht'];


			$remise_code_promo_ht = 0;


			$total_quantite = $this->compte_elements();


			if ($this->valeur_code_promo > 0) {


				$remise_code_promo_ht = $this->valeur_code_promo / $total_quantite  / (1+$prod['tva']/100); 


			}


			$prix_ht = ($prix_cat_ht + $option_ht + $total_prix_attributs_ht)

					 * (1- $prod['promotion']/100) 

					 * (1- $cat['promotion']/100) 

					 * (1- $this->percent_code_promo/100)

					 * (1- vn($_SESSION['utilisateur']['remise_percent'])/100)

					 * (1-  $this->percent_remise_groupe/100) - $remise_code_promo_ht;


			$this->prix_ht[] = $prix_ht + $prod['ecotaxe_ht']; // Aucune remise ne s'applique sur l'ecotaxe


			$this->prix[] = ($prix_ht + $prod['ecotaxe_ht']) * (1+$tva_percent/100);


			$this->prix_cat[] = ($prix_cat_ht + $prod['ecotaxe_ht']) * (1+$tva_percent/100);


			$total_prix	 = ($prix_ht + $prod['ecotaxe_ht']) * (1+$tva_percent/100) * $quantite;


			$this->total_prix[] = $total_prix;


			$total_prix_ht = ($prix_ht + $prod['ecotaxe_ht']) * $quantite;


			$this->total_prix_ht[] = $total_prix_ht;


			if ($this->zoneTva == 1) {


				$this->tva[] = $total_prix - $total_prix_ht;


				switch($prod['tva']) {


					case $taux_tva1:


						$this->total_prix1[] = $total_prix;

						$this->total_prix_ht1[] = $total_prix_ht;

						$this->total_prix2[] = $this->total_prix_ht2[] = $this->total_prix3[] = $this->total_prix_ht3[] = 0;

						$this->tva1[] = $total_prix - $total_prix_ht;

						$this->tva2[] = $this->tva3[] = 0;


					break;


					case $taux_tva2:

						$this->total_prix2[] = $total_prix;

						$this->total_prix_ht2[] = $total_prix_ht;

						$this->total_prix1[] = $this->total_prix_ht1[] = $this->total_prix3[] = $this->total_prix_ht3[] = 0;

						$this->tva2[] = $total_prix - $total_prix_ht;

						$this->tva1[] = $this->tva3[] = 0;


					break;


					case $taux_tva3:

						$this->total_prix3[] = $total_prix;

						$this->total_prix_ht3[] = $total_prix_ht;

						$this->total_prix1[] = $this->total_prix_ht1[] = $this->total_prix2[] = $this->total_prix_ht2[] = 0;

						$this->tva3[] = $total_prix - $total_prix_ht;

						$this->tva1[] = $this->tva2[] = 0;


					break;


				}


			} else {


			$this->tva[] = $this->tva1[] = $this->tva2[] = $this->tva3[] = 0;


				switch($prod['tva']) {


					case $taux_tva1:


						$this->total_prix1[] = $this->total_prix_ht1[] = $total_prix_ht;

						$this->total_prix2[] = $this->total_prix_ht2[] = $this->total_prix3[] = $this->total_prix_ht3[] = 0;


					break;


					case $taux_tva2:


						$this->total_prix2[] = $this->total_prix_ht2[] = $total_prix_ht;

						$this->total_prix1[] = $this->total_prix_ht1[] = $this->total_prix3[] = $this->total_prix_ht3[] = 0;


					break;


					case $taux_tva3:


						$this->total_prix3[] = $this->total_prix_ht3[] = $total_prix_ht;

						$this->total_prix1[] = $this->total_prix_ht1[] = $this->total_prix2[] = $this->total_prix_ht2[] = 0;


					break;


				}




			}





	$remise_ht = ($prix_cat_ht + $prod['ecotaxe_ht']) * $quantite + $option_ht * $quantite + $total_prix_attributs_ht * $quantite - $total_prix_ht;


	$this->remise_ht[] = $remise_ht;


	$this->remise[] = $remise_ht * (1+$tva_percent/100);



}


function place($i, 	$produitid, $quantite, $cId, $sId, $email_check, $liste_attribut) {


		global $taux_tva1, $taux_tva2, $taux_tva3, $module_lot;


		if (isset($i)) {


			$this->articles[$i] 	= $produitid;

			$this->quantite[$i] 	= $quantite;

			$this->couleurId[$i] 	= $cId;

			$this->tailleId[$i] 	= $sId;

			$this->email_check[$i] = $email_check;

			$this->id_attribut[$i] = $liste_attribut;

			/* Traitement des attributs */

			$attributs = "";


			$total_prix_attributs = 0;


			if ($liste_attribut != "") {


			$tableau_attribut = explode("-", $liste_attribut);


			foreach($tableau_attribut as $tableau_id) {


				$tableau_attribut_id =explode("|", $tableau_id);


				$requete1 = "SELECT nom_".$_SESSION['langue']." as nom FROM peel_nom_attributs WHERE id = '".intval($tableau_attribut_id[0])."'";


				$query1 = mysql_query($requete1);


					if (mysql_num_rows($query1) > 0) {


						$obj1 = mysql_fetch_object($query1);


						$nom_attribut = html_entity_decode($obj1->nom);


					}


				$requete2 = "SELECT prix, descriptif_".$_SESSION['langue']." as descriptif FROM peel_attributs WHERE id = '".intval($tableau_attribut_id[1])."'";


				$query2 = mysql_query($requete2);


					if (mysql_num_rows($query2) > 0) {


						$obj2 = mysql_fetch_object($query2);


						$desc_attribut = html_entity_decode($obj2->descriptif);


						$total_prix_attributs += $obj2->prix;


					}


				$attributs .= $nom_attribut." : ".$desc_attribut."<br />";


			}


			}


			$this->total_prix_attribut[$i] = $total_prix_attributs;


			$this->attribut[$i] = $attributs;


			/* Fin du traitement des attributs */



			$sql = "SELECT e.prix_ttc AS ecotaxe_ttc, e.prix_ht AS ecotaxe_ht, p.on_stock, p.tva, p.poids, p.promotion, p.delai_stock, p.prix / (1+p.tva/100) as prix_ht, p.prix_revendeur / (1+p.tva/100) as prix_revendeur_ht, p.points, p.on_flash, p.prix_flash, p.prix_flash / (1+p.tva/100) as prix_flash_ht

			FROM peel_produits p  

			LEFT JOIN peel_ecotaxes e ON (p.id_ecotaxe = e.id) 

			WHERE p.id = '".intval($produitid)."'";


			$query = mysql_query($sql);


			$prod = mysql_fetch_array($query);


			$this->delai_stock[$i] = $prod['delai_stock'];


			$this->etat_stock[$i] = $prod['on_stock'];


			$this->points[$i] = $prod['points'] * $quantite; // Total points de la ligne


			$tva_percent = ($this->zoneTva == 1) ? $prod['tva'] : 0; # Si la zone de TVA est active


			$this->tva_percent[$i] = $tva_percent; # Si la zone de TVA est active


			$this->couleur[$i] = recupere_couleur($cId);


			$tableau_taille = recupere_taille($sId);


			$taille = explode("|",$tableau_taille);


			$this->taille[$i] = $taille[1];


			$total_prix_attributs_ht = $total_prix_attributs / (1+$prod['tva']/100);


			$option_ht = $taille[0] / (1+$prod['tva']/100);


			$poids_taille = $taille[2];


			$this->poids[$i] = ($prod['poids']+$poids_taille) * $quantite; // Total poids de la ligne


			$this->option_ht[$i] = $option_ht;


			$this->option[$i] = $option_ht * (1+$tva_percent/100);


			$this->ecotaxe_ht[$i] = $prod['ecotaxe_ht'];


			$this->ecotaxe_ttc[$i] = $prod['ecotaxe_ht'] * (1+$tva_percent/100);


			// Calcul du prix


			$this->percent_remise_produit[$i] = $prod['promotion'];


			$query_cat = mysql_query("SELECT c.promotion FROM peel_categories c, peel_produits_categories pc WHERE pc.produit_id = '$produitid' AND c.id = pc.categorie_id");


			$cat = mysql_fetch_array($query_cat);


			$this->percent_remise_categorie[$i] = $cat['promotion'];


			if ($prod['on_flash'] == 0) {


			$prix_cat_ht = (isset($_SESSION['utilisateur']['priv']) && $_SESSION['utilisateur']['priv'] == "reve") ? $prod['prix_revendeur_ht'] : $prod['prix_ht'];


			} else {


			$prix_cat_ht = $prod['prix_flash_ht'];


			}


			if ($module_lot == 1) { /* Si le module de gestion des prix / quantité est actif */


				$sqlQte = "SELECT quantite, prix, prix_revendeur FROM peel_quantites WHERE produit_id = '".intval($produitid)."' ORDER BY quantite";


				$resQte = mysql_query($sqlQte) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());


				if (mysql_num_rows($resQte) > 0) { /* Si il existe des remises / quantité dans la base */


					while ($Qte = mysql_fetch_array($resQte)) {


						if ($quantite >= $Qte['quantite']) {


						$prix_cat_ht = (isset($_SESSION['utilisateur']['priv']) && $_SESSION['utilisateur']['priv'] == "reve") ? $Qte['prix_revendeur'] / (1+$tva_percent/100) : $Qte['prix'] / (1+$tva_percent/100);


					}


				}


			}


			}


			$this->prix_cat_ht[$i] = $prix_cat_ht + $prod['ecotaxe_ht'];


			$remise_code_promo_ht = 0;


			$total_quantite = $this->compte_elements();


			if ($this->valeur_code_promo > 0) {


				$remise_code_promo_ht = $this->valeur_code_promo / $total_quantite  / (1+$prod['tva']/100); 


			}


			$prix_ht = ($prix_cat_ht + $option_ht + $total_prix_attributs_ht)

					 * (1- $prod['promotion']/100) 

					 * (1- $cat['promotion']/100) 

					 * (1- $this->percent_code_promo/100)

					 * (1- vn($_SESSION['utilisateur']['remise_percent'])/100)

					 * (1-  $this->percent_remise_groupe/100) - $remise_code_promo_ht;


			$this->prix_ht[$i] = $prix_ht + $prod['ecotaxe_ht']; // Aucune remise ne s'applique sur l'ecotaxe


			$this->prix[$i] = ($prix_ht + $prod['ecotaxe_ht']) * (1+$tva_percent/100);


			$this->prix_cat[$i] = ($prix_cat_ht + $prod['ecotaxe_ht']) * (1+$tva_percent/100);


			$total_prix	 = ($prix_ht + $prod['ecotaxe_ht']) * (1+$tva_percent/100) * $quantite;


			$this->total_prix[$i] = $total_prix;


			$total_prix_ht = ($prix_ht + $prod['ecotaxe_ht']) * $quantite;


			$this->total_prix_ht[$i] = $total_prix_ht;


			if ($this->zoneTva == 1) {


				$this->tva[$i] = $total_prix - $total_prix_ht;


				switch($prod['tva']) {


					case $taux_tva1:


						$this->total_prix1[$i] = $total_prix;

						$this->total_prix_ht1[$i] = $total_prix_ht;

						$this->total_prix2[$i] = $this->total_prix_ht2[$i] = $this->total_prix3[$i] = $this->total_prix_ht3[$i] = 0;

						$this->tva1[$i] = $total_prix - $total_prix_ht;

						$this->tva2[$i] = $this->tva3[$i] = 0;


					break;


					case $taux_tva2:


						$this->total_prix2[$i] = $total_prix;

						$this->total_prix_ht2[$i] = $total_prix_ht;

						$this->total_prix1[$i] = $this->total_prix_ht1[$i] = $this->total_prix3[$i] = $this->total_prix_ht3[$i] = 0;

						$this->tva2[$i] = $total_prix - $total_prix_ht;

						$this->tva1[$i] = $this->tva3[$i] = 0;


					break;


					case $taux_tva3:


						$this->total_prix3[$i] = $total_prix;

						$this->total_prix_ht3[$i] = $total_prix_ht;

						$this->total_prix1[$i] = $this->total_prix_ht1[$i] = $this->total_prix2[$i] = $this->total_prix_ht2[$i] = 0;

						$this->tva3[$i] = $total_prix - $total_prix_ht;

						$this->tva1[$i] = $this->tva2[$i] = 0;


					break;


				}


			} else {


				$this->tva[$i] = $this->tva1[$i] = $this->tva2[$i] = $this->tva3[$i] = 0;


				switch($prod['tva']) {


					case $taux_tva1:


						$this->total_prix1[$i] = $this->total_prix_ht1[$i] = $total_prix_ht;

						$this->total_prix2[$i] = $this->total_prix_ht2[$i] = $this->total_prix3[$i] = $this->total_prix_ht3[$i] = 0;


					break;


					case $taux_tva2:


						$this->total_prix2[$i] = $this->total_prix_ht2[$i] = $total_prix_ht;

						$this->total_prix1[$i] = $this->total_prix_ht1[$i] = $this->total_prix3[$i] = $this->total_prix_ht3[$i] = 0;


					break;


					case $taux_tva3:


						$this->total_prix3[$i] = $this->total_prix_ht3[$i] = $total_prix_ht;

						$this->total_prix1[$i] = $this->total_prix_ht1[$i] = $this->total_prix2[$i] = $this->total_prix_ht2[$i] = 0;


					break;


				}


			}



	$remise_ht = ($prix_cat_ht + $prod['ecotaxe_ht']) * $quantite + $option_ht * $quantite + $total_prix_attributs_ht * $quantite - $total_prix_ht;


	$this->remise_ht[$i] = $remise_ht;


	$this->remise[$i] = $remise_ht * (1+$tva_percent/100);


		}


		ksort($this->articles);

		ksort($this->quantite);

		ksort($this->poids);

		ksort($this->points);

		ksort($this->couleur);

		ksort($this->taille);

		ksort($this->couleurId);

		ksort($this->tailleId);

		ksort($this->prix);

		ksort($this->prix_ht);

		ksort($this->prix_cat);

		ksort($this->prix_cat_ht);

		ksort($this->total_prix);

		ksort($this->total_prix_ht);

		ksort($this->total_prix1);

		ksort($this->total_prix_ht1);

		ksort($this->total_prix2);

		ksort($this->total_prix_ht2);

		ksort($this->total_prix3);

		ksort($this->total_prix_ht3);

		ksort($this->tva_percent);

		ksort($this->tva);

		ksort($this->tva1);

		ksort($this->tva2);

		ksort($this->tva3);

		ksort($this->percent_remise_produit);

		ksort($this->percent_remise_categorie);

		ksort($this->remise);

		ksort($this->remise_ht);

		ksort($this->etat_stock);

		ksort($this->delai_stock);

		ksort($this->option);

		ksort($this->option_ht);

		ksort($this->email_check);

		ksort($this->ecotaxe_ttc);

		ksort($this->ecotaxe_ht);

		ksort($this->id_attribut);

		ksort($this->attribut);

		ksort($this->total_prix_attribut);



}

Share this post


: post
Share on other sites

Posted · Report post

merci pour l'aide mais en fait faut modifier aussi des choses ailleurs car juste ça ça fonctionne qu'à moitié, genre dans les pages produits, les pages catégorie... encore du code que je n'ai pas.

Je suis preneur donc

Share this post


: post
Share on other sites

Posted · Report post

merci pour l'aide mais en fait faut modifier aussi des choses ailleurs car juste ça ça fonctionne qu'à moitié, genre dans les pages produits, les pages catégorie... encore du code que je n'ai pas.

Je suis preneur donc

Ce code attribut des promotions à chaque produit en fonction de la catégorie et se suffit à lui même

Je ne vois pas ce que vous voulez modifier de plus

Share this post


: post
Share on other sites

Posted · Report post

Ben dans les pages des catégories, le bout de code pour annoncer que cette catégorie est en promotion et pour chaque produit en promotion, l'affichage du prix barré avec le nouveau prix comme quand on met un produit en promotion manuellement dans sa fiche.

Share this post


: post
Share on other sites

Posted · Report post

Ben dans les pages des catégories, le bout de code pour annoncer que cette catégorie est en promotion et pour chaque produit en promotion, l'affichage du prix barré avec le nouveau prix comme quand on met un produit en promotion manuellement dans sa fiche.

Pour info sur votre site

la colonne censée être à droite (celle du panier) se trouve en bas à gauche avec IE6. Avec FIREFOX c'est correct.

J'ai le même probléme avec la derniére version de shopping V4. Je pense à un probléme de CSS (code pas compatible avec IE6) :rolleyes:

Share this post


: post
Share on other sites

Posted · Report post

merci je vais essayer de faire des recherches car en fait suis sous IE7 et il n'y a pas de problème.

Je pense peut être qu'il faut légèrement diminuer la largeur des colonnes mais je ne sais pas trop où chercher.

ça fait la même chose avec le site de démo peel 5.3 ?

Share this post


: post
Share on other sites

Posted · Report post

Ben dans les pages des catégories, le bout de code pour annoncer que cette catégorie est en promotion et pour chaque produit en promotion, l'affichage du prix barré avec le nouveau prix comme quand on met un produit en promotion manuellement dans sa fiche.

Vous pouvez m'en dire plus afin que je finalise s'il vous plait ?

Share this post


: post
Share on other sites

Posted · Report post

Pour info sur votre site

la colonne censée être à droite (celle du panier) se trouve en bas à gauche avec IE6. Avec FIREFOX c'est correct.

J'ai le même probléme avec la derniére version de shopping V4. Je pense à un probléme de CSS (code pas compatible avec IE6) :rolleyes:

De mémoire dans /modeles/votre template/sous_categorie.php, remplacez les cellpadding 5 en cellpadding 0

Share this post


: post
Share on other sites

Posted · Report post

ok merci, pour le style

Share this post


: post
Share on other sites

Posted · Report post

C'est bon, j'ai réussi à mettre en place les promotions par catégorie dans ma version 5.2.

S'il y en a qui sont intéressés, envoyez MP.

Share this post


: post
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
Sign in to follow this  
Followers 0

Twitter Advisto ecommerce

Facebook PEEL Shopping