Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. if ( !$http->hasPostVariable( 'Products' ) && !$http->postVariable( 'Products' ) )
  2. {
  3. //affecte la règle à l'ensemble des produits d'une catégorie
  4. //récupère stock minmum de la famille de produit sélectionné
  5. $selectedClasse = ( !is_array( $discountRuleSelectedClasses ) )?$discountRuleSelectedClasses:$discountRuleSelectedClasses[0];
  6. if( $selectedClasse == -1 )$selectedClasse = 19 ;//use cas indifférent
  7. $contentObjectList = eZContentObject::fetchSameClassList( $selectedClasse );
  8. foreach( $contentObjectList as $contentObject )
  9. {
  10. if( $contentObject->className() == 'Product' )
  11. {
  12. if( is_object( $contentObject ) )
  13. {
  14. $dataMap = $contentObject->dataMap();
  15. if( array_key_exists('quantity', $dataMap) && array_key_exists('quantite_en_commande_client', $dataMap) )
  16. {
  17. $quantity = (int)$dataMap['quantity']->toString() - (int)$dataMap['quantite_en_commande_client']->toString() ;
  18. if( (int)$stockMini <= $quantity )
  19. {
  20. $newProductArray[]= $contentObject ;
  21. }
  22. else
  23. {
  24. $resetProductArray[] = $contentObject ;
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement