Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.85 KB | None | 0 0
  1. Εμφάνιση των Latest Products μέσα στο Product Details.
  2.  
  3. Στο τέλος του αρχείου components/com_yagendooproductmanager/themes/yag_blueberry_etheme/productdetails/default.php
  4.  
  5. προσθέτουμε το patch:
  6.  
  7.  
  8. <style>
  9. div.recentProd {
  10. width:20%;
  11. border:1px solid #DEDEDE;
  12. position:relative;
  13. float:left;
  14. min-height:300px;
  15. text-align:center;
  16. margin:10px 0px;
  17. margin-right:45px;
  18. }
  19. div.recentImage{
  20.  
  21. text-align:center;
  22.  
  23. }
  24. .recentTitle {
  25. padding: 6px 5px 4px 16px ;
  26. margin: 0px 0px 10px;
  27. margin-bottom:15px;
  28. min-height: 24px;
  29. border-radius: 3px;
  30. font-weight: bold;
  31. border: 1px solid #D6D6D6;
  32. color: #707070;
  33. }
  34. div.recentSKU {
  35.  
  36. text-align:center;
  37. }
  38.  
  39. </style>
  40.  
  41. <?php $checkIfRel = $_SESSION["__vm"]["vmlastvisitedproductids"];
  42.  
  43. if(!empty($checkIfRel)) {
  44.     echo '<h1 class="recentTitle">Last Visited Products</h1><div >';
  45.    
  46.    
  47.     $maxcounter=1;
  48.  
  49.     foreach ($checkIfRel as $check) {
  50.     if($maxcounter<9) {
  51.         $db = JFactory::getDbo();
  52.        
  53.         $query="SELECT *,d.slug AS pslug,c.slug AS catslug FROM #__virtuemart_products as a LEFT JOIN uhhu_virtuemart_products_el_gr as d on a.virtuemart_product_id=d.virtuemart_product_id INNER JOIN #__virtuemart_product_categories as b ON a.virtuemart_product_id = b.virtuemart_product_id LEFT JOIN #__virtuemart_categories_el_gr AS c ON b.virtuemart_category_id=c.virtuemart_category_id WHERE a.virtuemart_product_id =". $check ." GROUP BY a.virtuemart_product_id ";
  54.         $db->setQuery($query);
  55.        
  56.         $options=$db->loadObjectList();
  57.        
  58.             foreach ($options as $row) {
  59.             $flag=false;
  60.             $childid=$row->virtuemart_category_id;
  61.             $hlink=$row->catslug;
  62.            
  63.             $mediaq= " SELECT file_url_thumb from #__virtuemart_medias where virtuemart_media_id = (SELECT virtuemart_media_id from #__virtuemart_product_medias where virtuemart_product_id=".$row->virtuemart_product_id ." LIMIT 1)";
  64.             $db->setQuery($mediaq);
  65.             $pimage=$db->loadResult();
  66.            
  67.            
  68.             while ($flag==false) {
  69.                 $query2="SELECT category_parent_id from #__virtuemart_category_categories where category_child_id=" . $childid;
  70.                 $db->setQuery($query2);
  71.                 $options2=$db->loadResult();
  72.                
  73.                
  74.                 if(!empty($options2)) {
  75.                     $query3="SELECT slug from #__virtuemart_categories_el_gr where virtuemart_category_id = " . $options2 ;
  76.                     $db->setQuery($query3);
  77.                     $catslug=$db->loadResult();
  78.                    
  79.                     $hlink = '/' . $catslug . '/'. $hlink ;
  80.                     $childid= $options2;
  81.                 }else {
  82.                     $flag=true;
  83.                     }
  84.                    
  85.                    
  86.                
  87.        
  88.        
  89.        
  90.         }
  91.        
  92.         echo '<div class="recentProd"><a style="color:#909090;" href="index.php'.$hlink. '/' . $row->pslug . '-detail"  >';
  93.         echo '<div class="recentImage"><img src="'.$pimage .'"/></br></div>';
  94.         echo $row->product_name . '</a></br><span style="color:#909090;">Sku:'.$row->product_sku.'</span></div>';
  95.        
  96.         $maxcounter++;
  97.         }  
  98.        
  99.    
  100.  
  101. }
  102. }
  103.  
  104.  
  105. }
  106.  
  107. ?>
  108. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement