News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Custom Filed Position

Started by mdt, August 12, 2015, 17:01:41 PM

Previous topic - Next topic

mdt

Hallo All

I am trying to change the Custom Field position in the Category View.

What I need to do is have a specific Custom field displaying after the Quantity selection box and before the ADD TO CART button.

Can someone please point me in the right direction on how to do this?

See the attached images.  1st image is how it looks now and 2nd is how I would like it to look (sort of)

balai

Have a look at the file: templates/YOUR TEMPLATE/html/com_virtuemart/category

mdt

Hi Balai

This is the code in my default.php in category folder.  I have added this to default.php to display the custom fields and add to cart button.  But what I can't work out is now to ONLY display the spesific Custom field below the Quantity box and before the add to cart button.

Can you please assist.

<div class="clear"> </div>
<div class="width100"> 
<?php // Add To Cart Button
  if (!VmConfig::get('use_as_catalog', 0) and !empty($product->prices)) {?>
<div class="addtocart-area"><form method="post" class="product js-recalculate" action="index.php">
  <?php // Product custom_fields
  if (!empty($product->customfieldsCart)) {  ?>
<div class="product-fields">
  <?php foreach ($product->customfieldsCart as $field)
  { ?>
<div style="text-align: left;" class="product-field product-field-type-<?php echo $field->field_type ?>">
  <span class="product-fields-title"><b><?php echo  JText::_($field->custom_title) ?></b></span>
  <?php if ($field->custom_tip) echo JHTML::tooltip($field->custom_tip,  JText::_($field->custom_title), 'tooltip.png'); ?>

       <span class="product-field-display"><?php echo $field->display ?></span>

  <span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
  </div>

  <?php
    }
  ?>
  </div>
  <?php }
  /* Product custom Childs
   * to display a simple link use $field->virtuemart_product_id as link to child product_id
   * custom_value is relation value to child
  */

  if (!empty($product->customsChilds)) {  ?>
<div class="product-fields">
  <?php foreach ($product->customsChilds as $field) {  ?>
<div style="display: inline-block; float: right; padding: 3px;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
  <span class="product-fields-title"><b><?php echo JText::_($field->field->custom_title) ?></b></span>
  <span class="product-field-desc"><?php echo JText::_($field->field->custom_value) ?></span>
  <span class="product-field-display"><?php echo $field->display ?></span>

  </div>

  <?php } ?>
  </div>
  <?php } ?>
<div class="addtocart-bar">

  <?php // Display the quantity box ?>
    <label for="quantity<?php echo $product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label>

    <span class="quantity-box">
        <input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($product->min_order_level) && (int)$product->min_order_level > 0) {
            echo $product->min_order_level;
        } else {
            echo '1';
        } ?>"/>
        </span>
                <span class="quantity-controls js-recalculate">
        <input type="button" class="quantity-controls quantity-plus"/>
        <input type="button" class="quantity-controls quantity-minus"/>
        </span>
  <!-- Display the quantity box END -->

  <?php // Add the button
  $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
  $button_cls = 'addtocart-button'; //$button_cls = 'addtocart_button';
  $button_name = 'addtocart'; //$button_cls = 'addtocart_button';


  // Display the add to cart button
  $stockhandle = VmConfig::get('stockhandle','none');
  if(($stockhandle=='disableit' or $stockhandle=='disableadd') and ($product->product_in_stock - $product->product_ordered)<1){
  $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
  $button_cls = 'notify-button';
  $button_name = 'notifycustomer';
  }
  vmdebug('$stockhandle '.$stockhandle.' and stock '.$product->product_in_stock.' ordered '.$product->product_ordered);
  ?>
  <span class="addtocart-button">
  <?php if ($button_cls == "notify-button") { ?>
         <span class="outofstock"><?php echo JText::_('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_STOCK'); ?></span>

           <?php } else {?>
           <input name="<?php echo $button_name ?>" class="<?php echo $button_cls ?>" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" type="submit" />
        <?php } ?>
  </span>
<div class="clear"> </div>
  </label></div>

  <?php // Display the add to cart button END ?>