osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

2 Pages V  < 1 2  
Reply to this topicStart new topic
> price break, mettre un texte
milerwan
posté 9 Nov 2006, 15:10
Message #26


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 173
Inscrit : 18-October 06
Membre no 12709



Bonjour,

Je suis dans le même cas que Mi6 avec les "prix promotions" (special price) qui ne sont pas pris en compte lors de l'ajout du produit au panier suite à l'install de price break.

Quelqu'un aurait-il une solution à ce pb?

Ce message a été modifié par milerwan - 9 Nov 2006, 15:11.


--------------------
osCommerce MS2.2 fr / MAJ sécurité 08.06

Contributions installées (47) :
Add weight to attributes v0.2 - Also purchased products - Atos - Autologon 108a - Best sellers scroll - Big images v1.25 - Cart with weight - Category box enhancement - Clear stats v1.4 - Colissimo/Distingo/recommandé (France, DOM-TOM, international) "perso" - Control new products - Customers stats orders - Disable Add to cart button - Disable "Add to cart" button if stock 0 or price 0 - E-mail address confirmation field - European Bank Transfer 1.9.1 - FCKeditor oscommerce v2 - Featured products v1.5.9 - Flash banners v2.0 - Graphical boxes v2 - Header Tags Controller v2.6.2 - Liaison SSL - Links manager v1.15 - LoginBox Best - Low stock 2 - Multiple products manager 2.15 - Must agree with terms - Newsdesk v1.48.3 updated - Newletter products v1.2 - Order Editor v5.0.6 - Order IP Recorder v1.5 - OSC Expeditor v2.2 - Payment fee - Paypal wpp v0.8.2 - Price in shopping card box - Price break v1.11.2 - Price Break with Special Price bug fixed - Print order Receipt 1.4 - Products on order v1.2 - Professional Invoice and Packing Slip - QT Pro 4.3 - Quick stock update v2.5 - Sub-total in basket - TVA intracom v5 - Ultimate SEO URL v2.x - Visitor web stats v3.1.2... ouf ! ^^
Go to the top of the page
 
Mi6
posté 9 Nov 2006, 16:01
Message #27


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 260
Inscrit : 29-July 03
Membre no 1348



et bien j'ai trouvé la solution à mon problème en faite. Donc voici mon includes/classes/PriceFormatter.php :

CODE
<?php
/*
  $Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

/*
    PriceFormatter.php - module to support quantity pricing

    Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)
*/

class PriceFormatter {
  var $hiPrice;
  var $lowPrice;
  var $quantity;
  var $hasQuantityPrice;

  function PriceFormatter($prices=NULL) {
    $this->productsID = -1;

    $this->hasQuantityPrice=false;
    $this->hasSpecialPrice=false;

    $this->hiPrice=-1;
    $this->lowPrice=-1;

    for ($i=1; $i<=8; $i++){
      $this->quantity[$i] = -1;
      $this->prices[$i] = -1;
    }
    $this->thePrice = -1;
    $this->specialPrice = -1;
    $this->qtyBlocks = 1;

    if($prices)
      $this->parse($prices);
  }

  function encode() {
    $str = $this->productsID . ":"
           . (($this->hasQuantityPrice == true) ? "1" : "0") . ":"
           . (($this->hasSpecialPrice == true) ? "1" : "0") . ":"
           . $this->quantity[1] . ":"
           . $this->quantity[2] . ":"
           . $this->quantity[3] . ":"
           . $this->quantity[4] . ":"
           . $this->quantity[5] . ":"
           . $this->quantity[6] . ":"
           . $this->quantity[7] . ":"
           . $this->quantity[8] . ":"
           . $this->price[1] . ":"
           . $this->price[2] . ":"
           . $this->price[3] . ":"
           . $this->price[4] . ":"
           . $this->price[5] . ":"
           . $this->price[6] . ":"
           . $this->price[7] . ":"
           . $this->price[8] . ":"
           . $this->thePrice . ":"
           . $this->specialPrice . ":"
           . $this->qtyBlocks . ":"
           . $this->taxClass;
    return $str;
  }

  function decode($str) {
    list($this->productsID,
         $this->hasQuantityPrice,
         $this->hasSpecialPrice,
         $this->quantity[1],
         $this->quantity[2],
         $this->quantity[3],
         $this->quantity[4],
         $this->quantity[5],
         $this->quantity[6],
         $this->quantity[7],
         $this->quantity[8],
         $this->price[1],
         $this->price[2],
         $this->price[3],
         $this->price[4],
         $this->price[5],
         $this->price[6],
         $this->price[7],
         $this->price[8],
         $this->thePrice,
         $this->specialPrice,
         $this->qtyBlocks,
         $this->taxClass) = explode(":", $str);

    $this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);
    $this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);
  }

  function parse($prices) {
    $this->productsID = $prices['products_id'];
    $this->hasQuantityPrice=false;
    $this->hasSpecialPrice=false;

    $this->quantity[1]=$prices['products_price1_qty'];
    $this->quantity[2]=$prices['products_price2_qty'];
    $this->quantity[3]=$prices['products_price3_qty'];
    $this->quantity[4]=$prices['products_price4_qty'];
    $this->quantity[5]=$prices['products_price5_qty'];
    $this->quantity[6]=$prices['products_price6_qty'];
    $this->quantity[7]=$prices['products_price7_qty'];
    $this->quantity[8]=$prices['products_price8_qty'];

    $this->thePrice=$prices['products_price'];
    $this->specialPrice=$prices['specials_new_products_price'];
    $this->hasSpecialPrice=tep_not_null($this->specialPrice);

    $this->price[1]=$prices['products_price1'];
    $this->price[2]=$prices['products_price2'];
    $this->price[3]=$prices['products_price3'];
    $this->price[4]=$prices['products_price4'];
    $this->price[5]=$prices['products_price5'];
    $this->price[6]=$prices['products_price6'];
    $this->price[7]=$prices['products_price7'];
    $this->price[8]=$prices['products_price8'];


     /*
       Change support special prices
       If any price level has a price greater than the special
       price lower it to the special price
    */
    if ($this->hasSpecialPrice == true) {
        for($i=1; $i<=8; $i++) {
            if ($this->price[$i] > $this->specialPrice)
                $this->price[$i] = $this->specialPrice;
        }
    }
    //end changes to support special prices

    $this->qtyBlocks=$prices['products_qty_blocks'];

    $this->taxClass=$prices['products_tax_class_id'];

    if ($this->quantity[1] > 0) {
      $this->hasQuantityPrice = true;
      $this->hiPrice = $this->thePrice;
      $this->lowPrice = $this->thePrice;

      for($i=1; $i<=8; $i++) {
    if($this->quantity[$i] > 0) {
      if ($this->price[$i] > $this->hiPrice) {
        $this->hiPrice = $this->price[$i];
      }
      if ($this->price[$i] < $this->lowPrice) {
        $this->lowPrice = $this->price[$i];
      }
    }
      }
    }
  }

  function loadProduct($product_id, $language_id=1)
  {
    $sql="select pd.products_name, p.products_model, p.products_image, p.products_id," .
        " p.manufacturers_id, p.products_price, p.products_weight," .
        " p.products_price1,p.products_price2,p.products_price3,p.products_price4, p.products_price5,p.products_price6,p.products_price7,p.products_price8," .
        " p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_price4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_price8_qty," .
        " p.products_qty_blocks," .
        " p.products_tax_class_id," .
        " IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
        " IF(s.status, s.specials_new_products_price, p.products_price) as final_price" .
        " from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
        "      " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id," .
        "      " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id" .
        " where p.products_status = '1'" .
        "   and p.products_id = '" . (int)$product_id . "'" .
        "   and pd.products_id = '" . (int)$product_id . "'" .
        "   and pd.language_id = '". (int)$language_id ."'";

    $product_info_query = tep_db_query($sql);
    $product_info = tep_db_fetch_array($product_info_query);
    $this->parse($product_info);

    return $product_info;
  }

  function computePrice($qty)
  {
    $qty = $this->adjustQty($qty);

    // Compute base price, taking into account the possibility of a special
    $price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;

    for ($i=1; $i<=8; $i++)
        if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
            $price = $this->price[$i];

    return $price;
  }

  function adjustQty($qty) {
    // Force QTY_BLOCKS granularity
    $qb = $this->getQtyBlocks();
    if ($qty < 1)
        $qty = 1;

    if ($qb >= 1)
    {
        if ($qty < $qb)
            $qty = $qb;

        if (($qty % $qb) != 0)
            $qty += ($qb - ($qty % $qb));
    }
    return $qty;
  }

  function getQtyBlocks() {
    return $this->qtyBlocks;
  }

  function getPrice() {
    return $this->thePrice;
  }

  function getLowPrice() {
    return $this->lowPrice;
  }

  function getHiPrice() {
    return $this->hiPrice;
  }

  function hasSpecialPrice() {
    return $this->hasSpecialPrice;
  }

  function hasQuantityPrice() {
    return $this->hasQuantityPrice;
  }

  function getPriceString($style='productPriceInBox') {
    global $currencies;

    if ($this->hasSpecialPrice == true) {
        $lc_text = '<table align="top" border="1" bordercolor="#FFFFFF" cellspacing="0" width="350" cellpadding="0">';
        $lc_text .= '<tr><td align="justify" class=' . $style. ' colspan="2"><b></b></td></tr>';
    }
    else
    {
        $lc_text = '<table align="top" border="1" bordercolor="#FFFFFF" cellspacing="0" width="350" cellpadding="0">';
        $lc_text .= '<tr><td align="justify" class=' . $style. ' colspan="2"><b></b></td></tr>';
    }
      // If you want to change the format of the price/quantity table
      // displayed on the product information page, here is where you do it.

    if($this->hasQuantityPrice == true) {
        for($i=1; $i<=8; $i++) {
            if($this->quantity[$i] > 0) {
                $lc_text .= '<tr><td class='.$style.'>&nbsp;&nbsp;'
                . $this->quantity[$i]
                .'+&nbsp;</td><td class='.$style.'>&nbsp;&nbsp;'
                . $currencies->display_price($this->price[$i],
                tep_get_tax_rate($this->taxClass))
                .'</td></tr>';
            }
        }

        $lc_text .= '</table>';

      }
      else {
        if ($this->hasSpecialPrice == true) {
            $lc_text = '&nbsp;<s>'
              . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
              . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">'
              . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
              . '</span>&nbsp;';
        }
        else {
            $lc_text = '&nbsp;'
              . $currencies->display_price($this->thePrice,
                       tep_get_tax_rate($this->taxClass))
              . '&nbsp;';
        }
          }

    return $lc_text;
  }

  function getPriceStringShort() {
    global $currencies;

    if ($this->hasSpecialPrice == true) {
      $lc_text = '&nbsp;<s>'
    . $currencies->display_price($this->thePrice,
                     tep_get_tax_rate($this->taxClass))
    . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">'
    . $currencies->display_price($this->specialPrice,
                     tep_get_tax_rate($this->taxClass))
    . '</span>&nbsp;';
    }
    else {
      if($this->hasQuantityPrice == true) {
    $lc_text = '&nbsp;'
      . $currencies->display_price($this->lowPrice,
                       tep_get_tax_rate($this->taxClass))
      . ' - '
      . $currencies->display_price($this->hiPrice,
                       tep_get_tax_rate($this->taxClass))
      . '&nbsp;';
      }
      else {
    $lc_text = '&nbsp;'
      . $currencies->display_price($this->thePrice,
                       tep_get_tax_rate($this->taxClass))
      . '&nbsp;';
      }
    }
    return $lc_text;
  }
}

?>


et dans product_info :

CODE
                   <?php if (($product_info['products_price1'])>0) { ?>


                        
                    <tr><td class="main" align="center"><b><?php echo TEXT_PRIX_DEGRESSIFS; ?></b></td></tr>
                   <tr><td class="main" align="center"><?php echo $products_price_qte; ?></td></tr>


                         </td></tr>
                         <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
                         <tr><td colspan=3 align=center><img src=images/m33.gif width=469 height=1></td></tr>
                         <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>

                        
                           <?php

                        }  else {   }?>


En espérant que ça te serve, moi depuis ça fonctionne parfaitement tongue.gif

David


--------------------
Version utilisée : ms2
Go to the top of the page
 
milerwan
posté 9 Nov 2006, 20:45
Message #28


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 173
Inscrit : 18-October 06
Membre no 12709



Waaaoouuuuhh !!!
C'est réparé maintenant, merci infiniment, tu es mon sauveur. wub.gif lol

Par contre la partie dans Product_info.php m'affiche "TEXT_PRIX_DEGRESSIFS" en dessous de Quantité.
A quoi cela correspondrait-il?

Une autre question, dans le listing des nouveaux produits, on trouve un seul prix affiché correspondant au prix le plus bas des prix dégressifs proposés.
Comment faire pour que le prix affiché propose plutôt la fouchette de prix comme lors du listing des produits?

Encore merci Mi6. wink.gif

Ce message a été modifié par milerwan - 9 Nov 2006, 21:06.


--------------------
osCommerce MS2.2 fr / MAJ sécurité 08.06

Contributions installées (47) :
Add weight to attributes v0.2 - Also purchased products - Atos - Autologon 108a - Best sellers scroll - Big images v1.25 - Cart with weight - Category box enhancement - Clear stats v1.4 - Colissimo/Distingo/recommandé (France, DOM-TOM, international) "perso" - Control new products - Customers stats orders - Disable Add to cart button - Disable "Add to cart" button if stock 0 or price 0 - E-mail address confirmation field - European Bank Transfer 1.9.1 - FCKeditor oscommerce v2 - Featured products v1.5.9 - Flash banners v2.0 - Graphical boxes v2 - Header Tags Controller v2.6.2 - Liaison SSL - Links manager v1.15 - LoginBox Best - Low stock 2 - Multiple products manager 2.15 - Must agree with terms - Newsdesk v1.48.3 updated - Newletter products v1.2 - Order Editor v5.0.6 - Order IP Recorder v1.5 - OSC Expeditor v2.2 - Payment fee - Paypal wpp v0.8.2 - Price in shopping card box - Price break v1.11.2 - Price Break with Special Price bug fixed - Print order Receipt 1.4 - Products on order v1.2 - Professional Invoice and Packing Slip - QT Pro 4.3 - Quick stock update v2.5 - Sub-total in basket - TVA intracom v5 - Ultimate SEO URL v2.x - Visitor web stats v3.1.2... ouf ! ^^
Go to the top of the page
 
milerwan
posté 10 Nov 2006, 12:24
Message #29


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 173
Inscrit : 18-October 06
Membre no 12709



Snif, c'est la larme à l'oeil que je vous livre ma première contribution au forum oscommerce. confused.gif

Il s'agit d'un mix du code de Mi6 avec ma présentation de tableau comprenant quantité, prix et pourcentage économisé.

Elle est disponible ici.

Voilu.


--------------------
osCommerce MS2.2 fr / MAJ sécurité 08.06

Contributions installées (47) :
Add weight to attributes v0.2 - Also purchased products - Atos - Autologon 108a - Best sellers scroll - Big images v1.25 - Cart with weight - Category box enhancement - Clear stats v1.4 - Colissimo/Distingo/recommandé (France, DOM-TOM, international) "perso" - Control new products - Customers stats orders - Disable Add to cart button - Disable "Add to cart" button if stock 0 or price 0 - E-mail address confirmation field - European Bank Transfer 1.9.1 - FCKeditor oscommerce v2 - Featured products v1.5.9 - Flash banners v2.0 - Graphical boxes v2 - Header Tags Controller v2.6.2 - Liaison SSL - Links manager v1.15 - LoginBox Best - Low stock 2 - Multiple products manager 2.15 - Must agree with terms - Newsdesk v1.48.3 updated - Newletter products v1.2 - Order Editor v5.0.6 - Order IP Recorder v1.5 - OSC Expeditor v2.2 - Payment fee - Paypal wpp v0.8.2 - Price in shopping card box - Price break v1.11.2 - Price Break with Special Price bug fixed - Print order Receipt 1.4 - Products on order v1.2 - Professional Invoice and Packing Slip - QT Pro 4.3 - Quick stock update v2.5 - Sub-total in basket - TVA intracom v5 - Ultimate SEO URL v2.x - Visitor web stats v3.1.2... ouf ! ^^
Go to the top of the page
 

2 Pages V  < 1 2
Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 25th May 2013 - 06:53
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)