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

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> [résolu] Problème avec la contribution : Stock Display
ACréation
posté 20 Jun 2010, 17:18
Message #1


Ceinture jaune+ OSC
Icône de groupe

Groupe : Membres
Messages : 87
Inscrit : 12-September 05
Membre no 7079



Bonjour,

J'ai peut être loupé un épisode mais je ne parviens pas à trouver comment afficher dans la fiche du produit (product_info.php) si un produit est disponible (en stock) ou pas.

Existe t'il une contribution ou alors suis-je passé à côté d'une évidence si grande que je ne la vois pas ? lol

D'avance merci pour votre aide.

Ce message a été modifié par ACréation - 24 Jun 2010, 23:39.


--------------------
Base : MS2 v2.2 RC1
Serveur : Apache 2.2.14
Php : 5.3.2

Contributions : Ultimate-SEO-URLs, Login Box V5.7, AJAX Shopping Cart V1.3, FCK Editor, LavoriamoPerVoi Ajax Popup Image
Go to the top of the page
 
greuter
posté 21 Jun 2010, 08:00
Message #2


Ceinture bleue OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1027
Inscrit : 16-December 02
Lieu : Est
Membre no 669



Entre autre :
arrow.gif Afficher l'état du stock par des images

Il existe aussi de des posts dans le forum
arrow.gif Ici!
arrow.gif Ici!
arrow.gif et là!
Go to the top of the page
 
ACréation
posté 23 Jun 2010, 10:49
Message #3


Ceinture jaune+ OSC
Icône de groupe

Groupe : Membres
Messages : 87
Inscrit : 12-September 05
Membre no 7079



Merci, c'est exactement ce que je recherchais ! Cependant, j'ai un petit souci avec la contrib. En effet, les produits sont tous affichés Hors Stock alors qu'ils le sont bien...J'ai inséré le code comme ceci dans product_info.php :

Code
<?php
        $prod_quantity = tep_get_products_stock($products_id);
        switch ($prod_quantity) {

        case 0: // change this to a quantity you want - it's the for "available on request"
            print '<img src="images/weiss.gif" border="0" title="" alt="' . TEXT_VERFUEGBARKEIT_WHITE . '"> ' . TEXT_VERFUEGBARKEIT_WHITE .' </font>';     
            break;

        case 1: // change this to a quantity you want - it's the number for "available within 10 workdays"
            print '<img src="images/gelb.gif" border="0" title="" alt="' . TEXT_VERFUEGBARKEIT_YELLOW . '"> ' . TEXT_VERFUEGBARKEIT_YELLOW . ' </font>';
            break;
    
        default: //if the quantity is not 1 or 0, this text will be shown.
        print '<img src="images/gruen.gif" border="0" title="" alt="' . TEXT_VERFUEGBARKEIT_GREEN . '"> ' . TEXT_VERFUEGBARKEIT_GREEN . ' </font>';
        }
    ?>


Quelque soit mon stock, il est toujours affiché en Hors Stock. Je ne comprend pas très bien ou cela peut clocher.

PS : J'ai changé l'intitulé du topic pour ne pas en créer un autre.


--------------------
Base : MS2 v2.2 RC1
Serveur : Apache 2.2.14
Php : 5.3.2

Contributions : Ultimate-SEO-URLs, Login Box V5.7, AJAX Shopping Cart V1.3, FCK Editor, LavoriamoPerVoi Ajax Popup Image
Go to the top of the page
 
miKL86
posté 24 Jun 2010, 14:32
Message #4


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 202
Inscrit : 8-November 04
Lieu : Futuroscope
Membre no 3714



Comment sont gérés tes stocks en admin ?


--------------------

Contrib installées : | Quick_stock_update | send_order_html_email | Contre remboursement | Paiement par téléphone | stats_customers_orders | seo |

Merci encore pour tout le travail fourni par toute la communauté Oscommerce
Liste des contributions
Go to the top of the page
 
ACréation
posté 24 Jun 2010, 18:15
Message #5


Ceinture jaune+ OSC
Icône de groupe

Groupe : Membres
Messages : 87
Inscrit : 12-September 05
Membre no 7079



Bonjour,

Mes stocks sont indiqués lorsque je créé un produit. J'indique la quantité de produit disponible.


--------------------
Base : MS2 v2.2 RC1
Serveur : Apache 2.2.14
Php : 5.3.2

Contributions : Ultimate-SEO-URLs, Login Box V5.7, AJAX Shopping Cart V1.3, FCK Editor, LavoriamoPerVoi Ajax Popup Image
Go to the top of the page
 
ACréation
posté 24 Jun 2010, 18:35
Message #6


Ceinture jaune+ OSC
Icône de groupe

Groupe : Membres
Messages : 87
Inscrit : 12-September 05
Membre no 7079



Sinon, j'ai tenté en mettant :

Code
$products_quantity


à la place de :

Code
$prod_quantity


Mais toujours pareil...


--------------------
Base : MS2 v2.2 RC1
Serveur : Apache 2.2.14
Php : 5.3.2

Contributions : Ultimate-SEO-URLs, Login Box V5.7, AJAX Shopping Cart V1.3, FCK Editor, LavoriamoPerVoi Ajax Popup Image
Go to the top of the page
 
ACréation
posté 24 Jun 2010, 23:39
Message #7


Ceinture jaune+ OSC
Icône de groupe

Groupe : Membres
Messages : 87
Inscrit : 12-September 05
Membre no 7079



Problème résolu tout seul quand j'ai uploadé sur mon serveur.


--------------------
Base : MS2 v2.2 RC1
Serveur : Apache 2.2.14
Php : 5.3.2

Contributions : Ultimate-SEO-URLs, Login Box V5.7, AJAX Shopping Cart V1.3, FCK Editor, LavoriamoPerVoi Ajax Popup Image
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 10:12
Message #8


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



Bonjour

Je me permet de relancer ce post car j'ai le même problème que ACréation, mais contrairement à lui même sur le serveur celà ne fonctionne pas , l'image qui s'affiche est toujours celle correspondant à un stock 0 .
Pour info voici le code que j'ai inséré
Code
$prod_quantity = tep_get_products_stock($products_id);
        switch ($prod_quantity) {
        
        case 0: // change this to a quantity you want - it's the for "available on request"
            echo '<img src="images/icons/stock_nostock.gif" border="0" title="" alt="' . TEXT_PRODUIT_EN_STOCK . '">';     
            break;

        case 1: // change this to a quantity you want - it's the number for "available within 10 workdays"
            echo '<img src="images/icons/stock_instock.gif" border="0" title="" alt="' . TEXT_PRODUIT_EN_STOCK . '">';
            break;
    
        default: //if the quantity is not 1 or 0, this text will be shown.
        echo '<img src="images/icons/stock_instock.gif" border="0" title="" alt="' . TEXT_PRODUIT_EN_STOCK . '">';
        }

J'ai aussi essayé ca :
Code
$prod_quantity = tep_get_products_stock($products_id);
if ($prod_quantity == 0) {
    echo '<img src="images/icons/stock_nostock.gif" border="0" title="" alt="' . TEXT_PRODUIT_EN_STOCK . '"> ';
} elseif ($prod_quantity >= 1) {
    echo '<img src="images/icons/stock_instock.gif" border="0" title="" alt="' . TEXT_PRODUIT_EN_STOCK . '">';

Rien n'y fait !!! J'ai l'impression que le problème viens de la fonction tep_get_products_stock($products_id) , mais je ne trouve pas de solution.
Si quelqu'un à une piste , merci d'avance .


--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 
Havock
posté 28 Oct 2011, 13:30
Message #9


Ceinture verte OSC
Icône de groupe

Groupe : Membres
Messages : 664
Inscrit : 4-February 04
Membre no 1926



Tu peux nous mettre ta fonction tep_get_products_stock ?


--------------------
L'indispensable est en cours de traitement,
L'urgent sera traité demain,
Le normal sera traité plus tard,
Le reste on vera ...
En conclusion : les journées sont trop courtes.
Utilisateur de MS2.2 Max 1.5 - OSC-Affiliate 1.09 - Admin With Access Levels 2.1 - Meta Tag Controller/ Generator - Credit/Gift Voucher/Coupons 5.05 - Download Controller v5.3 - X-Sell MS2 - WYSIWYG HTML Editor for Admin 1.7 - Dynamic Mo Pics - Loginbox Best - Order logging before payment processing - User Tracking - Faster Page Loads, Less DB queries - Plus plein de modifs perso :-)
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 13:55
Message #10


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



La fonction ce trouve dans le fichier general.php du dossier functions dans includes , au alentours de la ligne 108. je met le code :
Code
function tep_get_products_stock($products_id) {
    $products_id = tep_get_prid($products_id);
    $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
    $stock_values = tep_db_fetch_array($stock_query);

    return $stock_values['products_quantity'];
  }



--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 13:57
Message #11


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



Pour info , les valeurs dans la base de données du champs "products_quantity" dans la table "Products" sont correctes ... et se mettent à jours lorsque je change les valeurs dans les fiches produits dans la partie admin .


--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 
Bonbec
posté 28 Oct 2011, 14:00
Message #12


Ceinture verte OSC
Icône de groupe

Groupe : Membres
Messages : 708
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonjour,

La ligne $products_id = tep_get_prid($products_id); doit être en trop puisque le $products_id est passé dans l'appel de la fonction.


--------------------
Config : Osc 2.2 très fortement modifié ... entièrement refait en mai 2012 (passage en UTF-8 et Php 5.3). Le passage à la 2.3 demanderait trop de travail mais je la teste en local ...
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + bidouilles persos pas très OsCommerce (erreurs de jeunesse)
En local j'utilise UwAmp, que du bonheur ...
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 14:37
Message #13


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



Ok Bonbec , merci de ta réponse . Donc apparemment le problème ne viendrais pas de mes codes.
Je vais tester ça et je vous tiens au courant de mes avancées.


--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 
Bonbec
posté 28 Oct 2011, 15:00
Message #14


Ceinture verte OSC
Icône de groupe

Groupe : Membres
Messages : 708
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Re,

En fait j'ai dit une bétise wacko.gif
Je viens de récupérer l'ordi avec un fichier general.php et la fonction function tep_get_prid() retourne un ID Produit nettoyé au cas où ce serait un ID produit avec attributs.
Donc ne pas le retirer.

Vu que le code à ajouter se trouve dans le fichier products_info.php et que dans ce fichier il n'y a pas de variable $products_id le problème vient de là à mon avis.
Par contre il y a $product_info['products_id']

Donc logiquement le code devrait commencer par :
$prod_quantity = tep_get_products_stock($product_info['products_id']);
switch ($prod_quantity) {

J'espère que çà réparera ma bêtise happy.gif


--------------------
Config : Osc 2.2 très fortement modifié ... entièrement refait en mai 2012 (passage en UTF-8 et Php 5.3). Le passage à la 2.3 demanderait trop de travail mais je la teste en local ...
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + bidouilles persos pas très OsCommerce (erreurs de jeunesse)
En local j'utilise UwAmp, que du bonheur ...
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 16:04
Message #15


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



OK , je vais essayer ca .
Mais je ne comprend pas quelque chose, dis moi si je me trompe car je ne suis pas un dieu du php !!!
La variable $products_id est défini dans le fichier general.php qui est appelé par application_top dans cette page , non ?


--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 
Bonbec
posté 28 Oct 2011, 16:43
Message #16


Ceinture verte OSC
Icône de groupe

Groupe : Membres
Messages : 708
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Re,

Moi non plus je ne suis pas un dieu du Php, je suis d'ailleurs nettement plus doué avec ma machine de découpe & gravure laser smile.gif

Dans le fichier products_info.php le products_id est récupéré par $_GET['products_id'] donc il est sensé être passé en URL.
Ensuite il y a différents appels en BDD pour récupérer proprement les infos qui lui sont associées.
Perso je préfère utiliser les variables du fichier en question car à la relecture ultérieure c'est plus facile pour s'y retrouver.

Ce message a été modifié par Bonbec - 28 Oct 2011, 16:43.


--------------------
Config : Osc 2.2 très fortement modifié ... entièrement refait en mai 2012 (passage en UTF-8 et Php 5.3). Le passage à la 2.3 demanderait trop de travail mais je la teste en local ...
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + bidouilles persos pas très OsCommerce (erreurs de jeunesse)
En local j'utilise UwAmp, que du bonheur ...
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 17:18
Message #17


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



Effectivement le product_id est passé en GET , j'avais omis ce "détail" ... ceci expliquant cela . Merci pour c explication . je vais tester avec le nouveau code dés que je rentre chez moi .


--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 
freddyjack
posté 28 Oct 2011, 18:02
Message #18


Ceinture blanche+ OSC
Icône de groupe

Groupe : Membres
Messages : 34
Inscrit : 6-April 09
Membre no 24991



C bon , ça fonctionne biggrin.gif . Tu avais raison Bonbec , il fallait changer la première ligne de code par:
$prod_quantity = tep_get_products_stock($product_info['products_id']);
switch ($prod_quantity) {
Je trouve quand même bizarre que ACération ai réussi à faire fonctionner le code en l'état ... huh.gif
Merci beaucoup pour ton aide.


--------------------
osCommerce Online Merchant v2.2 RC1 W3C Valid FR v3

Serveur HTTP : Apache
Version PHP : 5.3

Contribution déjà installé :
BTS
Go to the top of the page
 

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 : 21st May 2013 - 08:21
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)