News:

Support the VirtueMart project and become a member

Main Menu

NO MORE THEME. 2+ uses VIEWS (Layout Override)

Started by PRO, September 14, 2011, 21:28:43 PM

Previous topic - Next topic

Flasher

This treath help me put my custom field after the price! Thank you all for all the examples. Now i want it to add the same CSS Style that the Sales Price.

I was looking around but i don't see any CSS Style on the defaul.php of the product detail.

My Custom field code is

<?php // Custom Field Precio
 if (!empty($this->product->customfieldsSorted['precio'])) { $this->position='precio'; echo $this->loadTemplate('customfields');    }   ?>

PRO


Flasher

Sorry PRO. My bad. I think i didn't explained my self well.

On my product detail i want to have the same CSS of the Sale Price (#1 on the Image) for my custom field (#2 on the Image)



[attachment cleanup by admin]

PRO

Quote from: Flasher on February 01, 2013, 20:08:38 PM
Sorry PRO. My bad. I think i didn't explained my self well.

On my product detail i want to have the same CSS of the Sale Price (#1 on the Image) for my custom field (#2 on the Image)



If you only use 1 language: you can do it like this in default_customfields.php
(I THINK this should work like you want, I did not test it)
What is does is separate the styling differently for that custom field position.
change "myposition"  to YOUR position
defined ( '_JEXEC' ) or die ( 'Restricted access' );
?>
<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[$this->position] as $field) {
       if ($field->layout_pos != myposition) {
          if ( $field->is_hidden ) //OSP http://forum.virtuemart.net/index.php?topic=99320.0
             continue;
         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;
         }
       }}
       ?>
      
       <?php
       if (!empty($this->product->customfieldsSorted[$this->position])) {
       foreach ($this->product->customfieldsSorted[$this->position] as $field ) {
      if ($field->layout_pos == myposition) {
          ?><div class="my-pos">Pago Con Tarjeta <span class="product-price"><?php echo $field->display ?></span></div>
          <?php
      }
       } }
       ?>
        </div>

Flasher

Hi again Pro. It worked well. I can see the price alignment but the CSS is the same. It doesn't appears like the Sale Price. Here is a screen.



[attachment cleanup by admin]

PRO

Quote from: Flasher on February 02, 2013, 01:32:31 AM
Hi again Pro. It worked well. I can see the price alignment but the CSS is the same. It doesn't appears like the Sale Price. Here is a screen.



http://forum.virtuemart.net/index.php?topic=102850.0


change the css


Flasher

Quote from: PRO on February 02, 2013, 17:52:24 PM
Quote from: Flasher on February 02, 2013, 01:32:31 AM
Hi again Pro. It worked well. I can see the price alignment but the CSS is the same. It doesn't appears like the Sale Price. Here is a screen.



TYVM sir!!! It's done!

http://forum.virtuemart.net/index.php?topic=102850.0


change the css



Flasher

Ok now that the CSS is working i'm having another issue. The Customfield Price is appearing Twice. I Remove the one from the exampled you gave me of default_customfields.php

and i'm doing everything on the the default.php of the template views. But i getting double custom fields on the screen.

Here is my code:

    <?php // Custom Field Precio
 if (!empty($this->product->customfieldsSorted['precio'])) { $this->position='precio'; echo $this->loadTemplate('customfields');    }   ?>

</div>
                  <?php
        if (!empty($this->product->customfieldsSorted[$this->position])) {
       
    foreach ($this->product->customfieldsSorted[$this->position] as $field ) {
        if ($field->layout_pos == precio) {
          
?>
<div class="PricesalesPrice">Pago con Tarjeta <span class="PricesalesPrice"><?php echo $field->display ?></span></div>
          <?php
      
}
       } }
       
?>

               
<?php ?>




[attachment cleanup by admin]

PRO


Flasher

Quote from: PRO on February 03, 2013, 15:37:49 PM
did you set it up like a cart variant?



No is not set like a cart variant. and i don't want it to be. It just a Information Price Field.

PRO

looks like its not removed from somewhere else

are you sure its not being called 2 times in your template?

Look here
http://forum.virtuemart.net/index.php?topic=90935.msg378890#msg378890

do you see where I changed the "normal" custom fields file to say
  if ($field->layout_pos != myposition) {

^^ that makes it NOT display in the regular custom fields

Flasher

Well i end it up erasing everything to start again. What is the best option to display the custom field.

On the viev folder of the template in the default.php file or in the default_customfields.php on the view folder of product details of virtuemart?????

PRO

like this

http://forum.virtuemart.net/index.php?topic=90935.msg378886#msg378886


then do the normal in default.php

<?php
if (!empty($this->product->customfieldsSorted['mypos'])) {
   $this->position='mypos';
   echo $this->loadTemplate('customfields');
?>

yagami

hi
I want to move the product name above the image, I also want to move the description, selling price, cost and details below the image.
would help me a lot thanks.
I searched the views in tmpl ... quiesiera find the div and you can modify as html.

http://balanar.netii.net/

PRO

Quote from: yagami on March 08, 2013, 23:54:02 PM
hi
I want to move the product name above the image, I also want to move the description, selling price, cost and details below the image.
would help me a lot thanks.
I searched the views in tmpl ... quiesiera find the div and you can modify as html.

http://balanar.netii.net/

http://forum.virtuemart.net/index.php?topic=97744.0

http://forum.virtuemart.net/index.php?topic=92756.0