linccce

vm add to card details view

Jul 2nd, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.47 KB | None | 0 0
  1. <?php
  2. /**
  3.  *
  4.  * Show the product details page
  5.  *
  6.  * @package    VirtueMart
  7.  * @subpackage
  8.  * @author Max Milbers, Valerie Isaksen
  9.  * @todo handle child products
  10.  * @link http://www.virtuemart.net
  11.  * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
  12.  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
  13.  * VirtueMart is free software. This version may have been modified pursuant
  14.  * to the GNU General Public License, and as distributed it includes or
  15.  * is derivative of works licensed under the GNU General Public License or
  16.  * other free or open source software licenses.
  17.  * @version $Id: default_addtocart.php 7833 2014-04-09 15:04:59Z Milbo $
  18.  */
  19. // Check to ensure this file is included in Joomla!
  20. defined('_JEXEC') or die('Restricted access');
  21. if (isset($this->product->step_order_level))
  22.     $step=$this->product->step_order_level;
  23. else
  24.     $step=1;
  25. if($step==0)
  26.     $step=1;
  27. $alert=vmText::sprintf ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED', $step);
  28. ?>
  29.  
  30. <div class="addtocart-area">
  31.  
  32.     <form method="post" class="product js-recalculate" action="<?php echo JRoute::_ ('index.php',false); ?>">
  33.         <?php /*         <input name="quantity[]" type="hidden" value="<?php echo $step ?>" />
  34.         <?php // Product custom_fields
  35.         /*if (!empty($this->product->customfieldsSorted['addtocart'])) {
  36.             $this->position = 'addtocart';
  37.             echo $this->loadTemplate('customfields');
  38.         } // Product Custom ontop end */
  39.  
  40.         $this->position = 'addtocart';
  41.  
  42.         if (!empty($this->product->customfieldsSorted[$this->position])) {
  43.             ?>
  44.             <div class="product-fields">
  45.                 <?php //foreach ($this->product->customfields as $field) {
  46.                 $this->product->row = $this->row;
  47.  
  48.                 foreach ($this->product->customfieldsSorted[$this->position] as $field) {
  49.                     //vmdebug('addtocart',$field);
  50.                     //Dont mix the systems, why we should not allow that someone is using this position just for information
  51.                 //if($field->is_cart_attribute==1){
  52.                     //The fields must have now a row, also the products
  53.                     //$field->row = $this->row;
  54.                     ?>
  55.                 <div class="product-field product-field-type-<?php echo $field->field_type ?>">
  56.                     <?php if ($field->show_title) { ?>
  57.                         <span class="product-fields-title-wrapper"><span class="product-fields-title"><strong><?php echo vmText::_ ($field->custom_title) ?></strong></span>
  58.                         <?php if ($field->custom_tip) {
  59.                             echo JHtml::tooltip ($field->custom_tip, vmText::_ ($field->custom_title), 'tooltip.png');
  60.                         } ?></span>
  61.                     <?php } ?>
  62.                     <span class="product-field-display"><?php echo $field->display ?></span>
  63.  
  64.                     <span class="product-field-desc"><?php echo $field->custom_desc ?></span>
  65.                 </div><br/>
  66.                     <?php
  67.                 //}
  68.             }
  69.                 ?>
  70.             </div>
  71.             <?php
  72.         }
  73.  
  74.         if (!VmConfig::get('use_as_catalog', 0)  ) {
  75.         ?>
  76.  
  77.         <div class="addtocart-bar">
  78.  
  79. <script type="text/javascript">
  80.         function check(obj) {
  81.         // use the modulus operator '%' to see if there is a remainder
  82.         remainder=obj.value % <?php echo $step?>;
  83.         quantity=obj.value;
  84.         if (remainder  != 0) {
  85.             alert('<?php echo $alert?>!');
  86.             obj.value = quantity-remainder;
  87.             return false;
  88.             }
  89.         return true;
  90.         }
  91. </script>
  92.  
  93.             <?php // Display the quantity box
  94.  
  95.             $stockhandle = VmConfig::get ('stockhandle', 'none');
  96.             if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
  97.                 ?>
  98.                 <a href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $this->product->virtuemart_product_id); ?>" class="notify"><?php echo vmText::_ ('COM_VIRTUEMART_CART_NOTIFY') ?></a>
  99.  
  100.                 <?php } else {
  101.                     $tmpPrice = (float) $this->product->prices['costPrice'];
  102.                     if (!( VmConfig::get('askprice', true) and empty($tmpPrice) ) ) {
  103.                 ?>
  104.                 <!-- <label for="quantity<?php echo $this->product->virtuemart_product_id; ?>" class="quantity_box"><?php echo vmText::_ ('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
  105.                 <span class="quantity-box">
  106.         <input type="text" class="quantity-input js-recalculate" name="quantity[]" onblur="check(this);" value="<?php if (isset($this->product->step_order_level) && (int)$this->product->step_order_level > 0) {
  107.             echo $this->product->step_order_level;
  108.         } else if(!empty($this->product->min_order_level)){
  109.             echo $this->product->min_order_level;
  110.         }else {
  111.             echo '1';
  112.         } ?>"/>
  113.         </span>
  114.                 <span class="quantity-controls js-recalculate">
  115.         <input type="button" class="quantity-controls quantity-plus"/>
  116.         <input type="button" class="quantity-controls quantity-minus"/>
  117.         </span>
  118.         <div class="clear"></div>
  119.                 <?php // Display the quantity box END
  120.        
  121.  
  122.                     // Display the add to cart button ?>
  123.  
  124.                     <span class="addtocart-button">
  125.                     <?php echo shopFunctionsF::getAddToCartButton ($this->product->orderable);
  126.  
  127.                         // Display the add to cart button END  ?>
  128.                     </span>
  129.                         <noscript><input type="hidden" name="task" value="add"/></noscript>
  130.                     <?php }
  131.                 ?>
  132.                
  133.                 <?php } ?>
  134.  
  135.         </div>
  136.         <?php } ?>
  137.         <input type="hidden" name="option" value="com_virtuemart"/>
  138.         <input type="hidden" name="view" value="cart"/>
  139.  
  140.         <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $this->product->virtuemart_product_id ?>"/>
  141.         <input type="hidden" class="pname" value="<?php echo htmlentities($this->product->product_name, ENT_QUOTES, 'utf-8') ?>"/>
  142.     </form>
  143.  
  144.     <div class="clear"></div>
  145. </div>
Advertisement
Add Comment
Please, Sign In to add comment