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

customfields in category site

Started by KlausHaag, July 29, 2012, 22:48:02 PM

Previous topic - Next topic

KlausHaag

Hallo i put the custom fields in category page, it works but the price do not update.
How i can update the price?

This is the code where i modify.

<?php // Output The Categories
function outputProductsCentered($item) {

   $product = $item;
   $currency = CurrencyDisplay::getInstance( );
   ?>

   <div class="spacer">

      <?php // Output Product Name ?>
      <h3 class="product-name"><?php echo JHTML::link ( JRoute::_ ( 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id ), $product->product_name, array ('title' => $product->product_name ) ); ?></h3>

      <?php // Output Product Image
      if ($product->images) { ?>
      <div class="product-thumbnail">
         <?php echo JHTML::_ ( 'link', JRoute::_ ( 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id ), $product->images[0]->displayMediaThumb( 'class="product-image" border="0"',false,'' ) ); ?>
      </div>
      <?php } ?>

      <!--
      <?php // Output Product SKU
      if(!empty($product->product_sku)) {?>
      <div class="product-sku">
         <?php echo JText::_('COM_VIRTUEMART_PRODUCT_SKU').': '.$product->product_sku ?>
      </div>
      <?php } ?>
      -->





      <?php // Output Product Prices
      if (VmConfig::get ( 'show_prices' ) == '1') { ?>
      <div class="product-prices">
      <?php
//       if ($showBasePrice) {
         echo $currency->createPriceDiv( 'basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices );
         echo $currency->createPriceDiv( 'basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices );
//       }
      echo $currency->createPriceDiv( 'variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices );
      echo $currency->createPriceDiv( 'basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices );
      echo $currency->createPriceDiv( 'discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $product->prices );
      echo $currency->createPriceDiv( 'salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices );
      echo $currency->createPriceDiv( 'priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices );
      echo $currency->createPriceDiv( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices );
      echo $currency->createPriceDiv( 'taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices );
      ?>
      </div>
      <?php } ?>


      <!--<?php // Output Category Link ?>
      <div class="category-name">
         <?php $categoryURL = JRoute::_ ( 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $product->virtuemart_category_id );
         echo JText::_('COM_VIRTUEMART_CATEGORY_NAME').': '.JHTML::link($categoryURL, '<span>'.$product->category_name.'</span>', array('title' => $product->category_name,'class' => 'category-name-link')); ?>
      </div>-->


        <!--
      <?php // Output Product Short Description
      if (!empty($product->product_s_desc)) { ?>
      <div class="product-short-desc">
         <?php
            echo shopFunctionsF::limitStringByWord($product->product_s_desc, 60 , '...');
         ?>
      </div>
      <?php } ?>-->


      <?php // Product Link As Action Button ?>
      <div class="product-link">
      <?php echo JHTML::link ( JRoute::_ ( 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id ), '<span>'.JText::_ ( 'COM_VIRTUEMART_PRODUCT_DETAILS' ).'</span>', array ('title' => $product->product_name, 'class' => 'btn-action-small' ) ); ?>
      </div>



<form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">
   <?php // Product custom_fields
   if (!empty($product->customfieldsCart)) {  ?>
   <div class="product-fields">
      <?php foreach ($product->customfieldsCart as $field)

/* custom field beginn */
            if ($field->display) {
         ?><div class="product-field product-field-type-<?php echo $field->field_type ?>">
         <?php if ($field->custom_title != $custom_title) { ?>
            <span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></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 jText::_($field->custom_field_desc) ?></span>
         </div>
         <?php
         $custom_title = $field->custom_title;
      }


/*custom field end*/


      { ?>
         <?php
      }
      ?>
   </div>



   <?php } ?>
      <div class="btn-green">

         <?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" name="quantity[]" value="1" />
         </span>
         <span class="quantity-controls">
            <input type="button" class="quantity-controls quantity-plus" />
            <input type="button" class="quantity-controls quantity-minus" />
         </span>
         <?php // Display the quantity box END ?>

         <?php // Add the button
         $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
         $button_cls = ''; //$button_cls = 'addtocart_button';
         if (VmConfig::get('check_stock') == '1' && !$product->product_in_stock) {
            $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
            $button_cls = 'notify-button';
         } ?>

         <?php // Display the add to cart button ?>
      <span class="addtocart-button-area">
         <span class="btn-green"><input type="submit" name="addtocart"  class="btn-green addtocart-button" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO') ?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO') ?>" /></span>
      </span>

      <div class="clear"></div>
      </div>

      <?php // Display the add to cart button END ?>
      <input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
      <input type="hidden" name="option" value="com_virtuemart" />
      <input type="hidden" name="view" value="cart" />
      <noscript><input type="hidden" name="task" value="add" /></noscript>
      <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
      <?php /** @todo Handle the manufacturer view */ ?>
      <input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
      <input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form>
   </div>
<?php } ?>


Picture virtuemart-info1.jpg shows
1. Warenkorb Variante and 2. Allgemeine Variable für Produktvarianten.
When i click on Warenkorb Variante nothings happens.
When i click on Allgemeine Variable für Produktvarianten i come to the Productdetail-Page.
Add to cart is okay with the correct price what i select.
Only the did not update.


[attachment cleanup by admin]

highlander411

I'm have a similar issue as well.