VirtueMart Forum

VirtueMart 2 + 3 => Templating & Layouts => Topic started by: PRO on November 03, 2011, 17:16:20 pm

Title: Product Page Fields For Templating
Post by: PRO on November 03, 2011, 17:16:20 pm
Product Page Fields:
For category fields, look here http://forum.virtuemart.net/index.php?topic=97744.0

PLEASE see http://forum.virtuemart.net/index.php?topic=98505.0


Product Name
<?php echo $this->product->product_name ?>

Product SKU
<?php echo $this->product->product_sku ?>

Ask a question about this product
<a class="ask-a-question" href="<?php echo $url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>
Short Description
   <?php echo $this->product->product_s_desc ?>

Product Full Description
      <?php echo $this->product->product_desc ?>

Product MAIN Image (the 0 is the column number for the 1st image)
<?php echo $this->product->images[0]->displayMediaFull('class="product-image"',false) ?>

Additional Images (>1 means all images past the 1st image)
      <?php if(!empty($this->product->images) && count($this->product->images)>1) {
         foreach ($this->product->images as $image) {
            echo $image->displayMediaThumb('class="product-image"',true,'class="modal"'); //'class="modal"'
         }
}
?>

Product Availability AS TEXT
<?php echo $this->product->product_availability; ?>

Product Availability As Picture
<?php echo JHTML::image(JURI::root().VmConfig::get('assets_general_path').'images/availability/'.$this->product->product_availability, $this-
>product->product_availability, array('class' => 'availability')); ?>

Minimum Order Level
<?php echo $this->product->min_order_level ?>

Maximum Order Level
<?php echo $this->product->max_order_level ?>

Product Unit
<?php echo $this->product->product_unit ?>

Product Weight
<?php echo $this->product->product_weight ?>

Product Weight Unit of Measure
<?php echo $this->product->product_weight_uom ?>

Product Length
<?php echo $this->product->product_length ?>

Product Width
<?php echo $this->product->product_width ?>

Product Height
<?php echo $this->product->product_height ?>

Product URL
<?php echo $this->product->product_url ?>

Product # In Stock
<?php echo $this->product->product_in_stock ?>

Product Availability Date
<?php echo $this->product->product_available_date ?>

Product Special 0 or 1 0 for no, 1 for yes.
<?php echo $this->product->product_special ?>

Product Packaging
<?php echo $this->product->product_packaging ?>

Create a link to the product's main category from the product page.
$catturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.JRequest::getInt('virtuemart_category_id',0));

<a href="<?php echo $catturl ?>"><?php echo $this->category->category_name ?></a>

Manufacturer Name
<?php echo $this->product->mf_name ?>
Title: Re: Product Page Fields For Templating
Post by: PRO on November 04, 2011, 18:05:39 pm
All Fields Above can be used for extra fields, and features on the product page.

For example. I use product weights of 0 to be items with free shipping. So, to display "FREE Shipping"  to the user, I do this.

<?php if ($this->product->product_weight == 0) { ?>
                  <div>Free Shipping on this Item! Minimum Order Quantity <?php echo $this->product->min_order_level ?></div>
               <?php    }?>

So the code above shows free shipping, and the minimum quantity order amount.

You can do the same with most fields.

To display an icon, or text if a product is featured you can do this.

<?php if ($this->product->product_special == 1) { ?>
                  <div>SALE ITEM!!!!! </div>
               <?php    }?>

Tell the customer the stock is low, and they should order NOW!
<?php if ($this->product->product_in_stock <= 10) { ?>
                  <div>ONLY <?php echo $this->product->product_in_stock ?> In Stock. ORDER BEFORE IT'S TOO LATE</div>
               <?php    }?>
Title: Re: Product Page Fields For Templating
Post by: kode5 on November 19, 2011, 14:28:48 pm
Hi,

I tried for several hours now, and I can't figure out how to use the Product Page Fields.

Can someone please make a guide/tutorial for noobs like me?

Thanks in advance.
Daniel
Title: Re: Product Page Fields For Templating
Post by: PRO on November 19, 2011, 14:34:46 pm
http://forum.virtuemart.net/index.php?topic=90935.0
Title: Re: Product Page Fields For Templating
Post by: kode5 on November 21, 2011, 21:18:03 pm
I can't get it to work.
Can you please give an example of an edited product details page default.php including Product SKU:
Code: [Select]
Product SKU
<?php echo $this->product->product_sku ?>
Title: Re: Product Page Fields For Templating
Post by: PRO on November 21, 2011, 21:51:57 pm
I can't get it to work.
Can you please give an example of an edited product details page default.php including Product SKU:
Code: [Select]
Product SKU
<?php echo $this->product->product_sku ?>

USE and override,
http://forum.virtuemart.net/index.php?topic=90935.0

and how is it not working?
Title: Re: Product Page Fields For Templating
Post by: matteo on January 20, 2012, 17:34:01 pm
Can i get the from an overridden product details page the url of the main image and the additional images?
I’d like to build a different <img> tag, so I need the file_url_thumb used in the "VmImage" class I think.
Title: Re: Product Page Fields For Templating
Post by: PRO on January 20, 2012, 17:53:28 pm
what?
Title: Re: Product Page Fields For Templating
Post by: matteo on January 20, 2012, 18:32:52 pm
I’m sorry, I’ll try to explain it better:
I have a view to modify: /templates/MYTEMPLATE/html/com_virtuemart/productdetails/default.php
If I use the "page field" echo $this->product->images[0]->displayMediaFull('class="product-image"',false) I get as generated code this:
Code: [Select]
<div class="main-image">
<img src="MY_IMAGE_URL.jpg" alt="MYIMAGENAME" class="product-image"><span class="vm-img-desc">MY_IMAGE_NAME</span>
</div>
and for the for the additional images, if I use the "page field" echo $image->displayMediaThumb('class="product-image"',true,'class="modal"',true,true); I get this:
Code: [Select]
<div class="additional-images">
<a title="MY_IMAGE_NAME" class="modal" href="MY_IMAGE_URL.jpg"><img src="MY_THUMB_URL.jpg" alt="MY_IMAGE_NAME" class="product-image"></a><span class="vm-img-desc">MY_IMAGE_NAME</span>
<a title="MY_IMAGE_NAME" class="modal" href="MY_IMAGE_URL.jpg"><img src="MY_THUMB_URL.jpg" alt="MY_IMAGE_NAME" class="product-image"></a><span class="vm-img-desc">MY_IMAGE_NAME</span>
</div>

I need to use in the /templates/MYTEMPLATE/html/com_virtuemart/productdetails/default.php the url of the images and of the thumbnails so I can have as generated code a different html structure like (for example) this:
Code: [Select]
<div id="MY_ID">
 <div class="MY_CLASS">
<ul class="MY_CLASS">
  <li><li style="position: absolute; left: 17px; "><img src="MY_THUMB_URL01.jpg" width="80" height="45" alt="MY_IMAGE_NAME01"></li></li>
  <li><li style="position: absolute; left: 107px; "><img src="MY_THUMB_URL02.jpg" width="80" height="45" alt="MY_IMAGE_NAME02"></li></li>
</ul>
 </div>
</div>
Title: Re: Product Page Fields For Templating
Post by: PRO on January 20, 2012, 18:44:30 pm
what do you want it to look like? it seems you are going the wrong way about this
Title: Re: Product Page Fields For Templating
Post by: matteo on January 20, 2012, 18:58:23 pm
I’d like to generate the right structure to use another kind of lightbox or gallery.
I’d like to try with Widgetkit (http://www.yootheme.com/widgetkit/examples/gallery) .
The structure they use to generate the galleries is this:

Code: [Select]
<div id="gallery-<?php echo $widget_id?>" class="wk-slideshow wk-slideshow-default" data-widgetkit="slideshow" data-options='<?php echo json_encode($settings); ?>'>
<div>
<ul class="slides">

<?php foreach ($images as $image) : ?>
           
<?php
$navigation[] = '<li><span></span></li>';
$captions[]   = '<li>'.(strlen($image['caption']) ? $image['caption']:"").'</li>';
$lightbox     '';

/* Prepare Lightbox */
if ($settings['lightbox'] && !$image['link']) {
$lightbox 'data-lightbox="group:'.$widget_id.'"';
}

/* Prepare Image */
$content '<img src="'.$image['cache_url'].'" width="'.$image['width'].'" height="'.$image['height'].'" alt="'.$image['filename'].'" />';

/* Lazy Loading */
$content = ($i==$settings['index']) ? $content $this['image']->prepareLazyload($content);
?>


<?php if ($settings['lightbox'] || $image['link']) : ?>
<li><a class="" href="<?php echo $image['link'] ? $image['link'] : $image['url']; ?>" <?php echo $lightbox?>><?php echo $content?></a></li>
<?php else : ?>
<li><?php echo $content?></li>
<?php endif; ?>

<?php $i=$i+1;?>
<?php endforeach; ?>

</ul>
        <?php if ($settings['buttons']): ?><div class="next"></div><div class="prev"></div><?php endif; ?>
<div class="caption"></div><ul class="captions"><?php echo implode(''$captions);?></ul>
</div>
<?php echo ($settings['navigation'] && count($navigation)) ? '<ul class="nav">'.implode(''$navigation).'</ul>' '';?>
</div>
and I’d like to modify it and use VirtueMart images and product variables.
Title: Re: Product Page Fields For Templating
Post by: PRO on January 20, 2012, 20:04:58 pm
http://forum.virtuemart.net/index.php?topic=91870.0
Title: Re: Product Page Fields For Templating
Post by: matteo on January 20, 2012, 20:39:38 pm
Thanks, so I’ll use something like this to get the thumbnail list:
Code: [Select]
<ul class="MY_CLASS">
<?php // List all Images
foreach ($this->product->images as $image) {
?>
<li <?php echo $thstyle?>><img src="<?php echo $image->file_url_thumb?>" width="80" height="45" alt="MY_IMAGE_NAME01"></li>
<?php
?>

</ul>
Title: Re: Product Page Fields For Templating
Post by: Mole_LR on February 01, 2012, 17:41:37 pm
Hello!
What about Product page fields for Prices (all variants), for checking does prouct has discount (for templating page with products which have discount)?

Thank You!
Title: Re: Product Page Fields For Templating
Post by: malibu2792 on February 07, 2012, 18:38:40 pm
Hi, I'm trying to add the  product sku on the product details page using : "<?php echo $this->product->product_sku ?>" I have done the overwrites as explained in the above. I can not seem to figure this out. I am trying to place it before the price. What else needs to be added?

Thanks,
John
Title: Re: Product Page Fields For Templating
Post by: PRO on February 07, 2012, 21:03:06 pm
this should work

<?php echo $this->product->product_sku ?>

YOU are probably adding it in teh wrong place
Title: Re: Product Page Fields For Templating
Post by: kohno97 on February 09, 2012, 12:41:39 pm
An additional field (regarding product's measurement) is
$this->product->product_lwh_uoc that returns the measurement unit.

Now a question: how can I use these values (as well as with product_weight_uoc) so I can get a localised string? The backend provides such localisation strings...
Title: Re: Product Page Fields For Templating
Post by: channelvision on February 16, 2012, 19:28:39 pm
I'm trying to insert the product availability date on our product details view. I can insert <?php echo $this->product->product_available_date ?> and the date shows up but its in UNIX format, and it shows up on products that have a blank product availability date.

What I would like to do is have product availability dates show up only on products that I set a date on and have the date in the correct format MM/DD/YYYY. Any help would be awesome.
Title: Re: Product Page Fields For Templating
Post by: PRO on February 16, 2012, 19:44:18 pm
I'm trying to insert the product availability date on our product details view. I can insert <?php echo $this->product->product_available_date ?> and the date shows up but its in UNIX format, and it shows up on products that have a blank product availability date.

What I would like to do is have product availability dates show up only on products that I set a date on and have the date in the correct format MM/DD/YYYY. Any help would be awesome.

The shop date format is in the language file

com_virtuemart.ini I believe
Title: Re: Product Page Fields For Templating
Post by: channelvision on February 16, 2012, 20:40:24 pm
Any idea how to make it only show up on the products that I put in a date, and not all of them like the previous version did?
Title: Re: Product Page Fields For Templating
Post by: PRO on February 17, 2012, 13:22:04 pm
Any idea how to make it only show up on the products that I put in a date, and not all of them like the previous version did?

Product Availability AS TEXT
<?php echo $this->product->product_availability; ?>





You can just use product availability easily.

11/20/2012



Title: Re: Product Page Fields For Templating
Post by: channelvision on February 17, 2012, 22:21:25 pm
Yeah when you use <?php echo $this->product->product_availability; ?> it will spit out a 0000-00-00 00:00:00 on products that don't have an assigned availability date. How I can make it say like currently available instead of that? see attached.

[attachment cleanup by admin]
Title: Re: Product Page Fields For Templating
Post by: channelvision on February 17, 2012, 22:38:59 pm
Alright I figured a work around, I can use the product availabilty text code. And it that either type in stock or the date its available. Downside to this is once that date passes I need to go back and change it to in stock. VERY TIME CONSUMING. Previous version of VM would just change it automatically from the date to instock once the date passed. I'd be willing to pay someone to fix that because we have 1000 products
Title: Re: Product Page Fields For Templating
Post by: PRO on February 18, 2012, 00:29:15 am

  <?php if (!empty($this->product->product_availability)) {
echo $this->product->product_availability;
    }?>
Title: Re: Product Page Fields For Templating
Post by: channelvision on February 18, 2012, 00:44:17 am
wouldn't it be:
<?php if (!empty($this->product->product_availability_date)) {
echo $this->product->product_availability;
    }?>

that way it shows the date, and if there isn't a date it shows the availablity which says "in stock"

But then I still have the problem of the format of the date... I can't figure out anywhere to show MM/DD/YYYY for availability date.
Title: Re: Product Page Fields For Templating
Post by: channelvision on February 18, 2012, 00:52:01 am
Didn't work :(
Title: Re: Product Page Fields For Templating
Post by: hermtek on February 21, 2012, 01:33:55 am
Hello everyone,
this is my first post here, usually I use the italian forum.
I want to insert the field "manufacturer name", is it possible?
Can anyone help me?
Title: Re: Product Page Fields For Templating
Post by: ahaaaa on March 23, 2012, 00:36:19 am
Hi,

try adding:-

<div class="manufacturer"><?php echo $this->product->mf_name ?></div>

Title: Re: Product Page Fields For Templating
Post by: RuBAN on April 14, 2012, 14:13:18 pm
Can I translate units (GR, M, etc.) to another language without PHP fixes?
Title: Re: Product Page Fields For Templating
Post by: TimHoogland on June 05, 2012, 22:48:38 pm
Hello,

<?php echo $this->product->product_width ?>
<?php echo $this->product->product_height ?>

I succeed in adding this two rows in an override file, but now the numbers are presented like:

Hoogte :60.0000 cm.
Potmaat :17.0000 cm.

How can I present integers instead of the above format?

Like to hear from you,

Tim Hoogland

Title: Re: Product Page Fields For Templating
Post by: petepeith on June 07, 2012, 08:23:44 am
How to change the size of Product MAIN Image, not to show full size?
Title: Re: Product Page Fields For Templating
Post by: ThomasR on July 10, 2012, 14:06:12 pm
Dear All,

I would like to 'print' all the categories, where the product is assigned to, on the productpage (with URL's).
I found an plugin for Joomla 1.5 (http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-categories/9106  (http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-categories/9106)) with this function but it doesn't work on Virtuemart 2.0

Does someone have the solution for this?

With kind regards / Met vriendelijke groet
Thomas
Title: Re: Product Page Fields For Templating
Post by: flaterik on July 10, 2012, 14:38:52 pm
How to change the size of Product MAIN Image, not to show full size?

give to the main image Class
max-size: 100%
Title: Re: Product Page Fields For Templating
Post by: flaterik on July 10, 2012, 14:41:11 pm
ther's the product-sku field, but the order product is possible to display?
Title: Re: Product Page Fields For Templating
Post by: webdiez on August 01, 2012, 13:40:59 pm
Whether it is possible to make a similar template of the goods?
http://www.n-store.ru/device/item/nokia_lumia_710/002Z1P7/
Title: Re: Product Page Fields For Templating
Post by: stephaNNb on August 20, 2012, 16:26:44 pm
Hy There !

I wan't to remove quantity box from module virtuemart_products .
But i don't know how to do that?
Can somebody help me please?

LINK to prove! :)
http://produseteleshopping.eu/index.php/magazin (http://produseteleshopping.eu/index.php/magazin)
Title: Re: Product Page Fields For Templating
Post by: PRO on August 20, 2012, 17:49:06 pm
Hy There !

I wan't to remove quantity box from module virtuemart_products .
But i don't know how to do that?
Can somebody help me please?

LINK to prove! :)
http://produseteleshopping.eu/index.php/magazin (http://produseteleshopping.eu/index.php/magazin)


either you have to "'display:none"    with css, or not show the add to cart at all
Title: Re: Product Page Fields For Templating
Post by: stephaNNb on August 20, 2012, 18:07:30 pm
either you have to "'display:none"    with css, or not show the add to cart at all
Thank you for you're quite reply
Where Mate ?
In the vmsite-ltr.css
i have this code :
Code: [Select]
span.quantity-box{float:left;width:27px;padding-top:5px;}
input.quantity-input{height:19px;width:25px;text-align:center;font-weight:700;padding:2px;}
span.quantity-controls{width:15px;float:left;padding-top:2px;margin:0 0 0 10px;}
span.quantity-controls input.quantity-controls{height:14px;border:none;width:15px;}
span.quantity-controls input.quantity-plus{background:url(../images/vmgeneral/quantity-controls.png) repeat-x;margin-bottom:2px;}
span.quantity-controls input.quantity-minus{background:url(../images/vmgeneral/quantity-controls.png) repeat-x;background-position:15px 0;}
.addtocart-bar{margin:0;padding:0;}
span.addtocart-button{width:152px;float:left;margin:0 0 0 10px;}
span.cart-images img {
    float: left;
    margin: 0;
    width: 45px;
}
span.addtocart-button input.addtocart-button,span.addtocart-button input.notify-button{width:152px;background:#e8e8e8 url(../images/vmgeneral/backgrounds.png) top repeat-x;background-position:0 -160px;color:#fff;border:solid #00a000 1px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;font-size:14px;cursor:pointer;height:34px;text-align:center;letter-spacing:1px;padding:4px 5px;}
Title: Re: Product Page Fields For Templating
Post by: guidocx842 on August 31, 2012, 16:58:02 pm
Hi everybody!
I'm looking for a image gallery module for Virtuemart 2 (Joomla 2.5) that shows dynamically all related products (products of the same category) of the product that I'm looking on the product details page.
Then I need to put it where usually you can see the description (that I move to the right of the product image). When the user click on a product image of the gallery, the user have to be redirected to the product details page of that product.
Please, can you suggest me a solution? Thanks a lot!  ;)
Title: Re: Product Page Fields For Templating
Post by: Marba917 on September 05, 2012, 20:27:34 pm
Hello guys,

I have a custom field in my products named "video" as a string

How can i call this string using php code?

like this:

<?php echo $this->product->product_desc ?>

but with the custom field?

many thanks for your help

Joomla 1.5 and VM 2.0.8
Title: Re: Product Page Fields For Templating
Post by: PRO on September 05, 2012, 21:00:39 pm
Hello guys,

I have a custom field in my products named "video" as a string

How can i call this string using php code?

like this:

<?php echo $this->product->product_desc ?>

but with the custom field?

many thanks for your help

Joomla 1.5 and VM 2.0.8


http://forum.virtuemart.net/index.php?topic=99225.0
Title: Re: Product Page Fields For Templating
Post by: sajtfokus on October 08, 2012, 04:47:15 am
Hello,

I would like to show an image on my product page (a "buy" image located somewhere on the server, e.g. "/images/vmimages/buy_image.jpg"), and also I would like that image to be linked with the URL specified in the product information (URL field).

If that requires too much of a coding knowledge, I can satisfy with link pointing to the specified url in the product information.

As far as I know, this code <?php echo $this->product->product_url ?> is showing Product URL as text. I just want that text to be linked with the URL specified in the Product Information.

I hope someone knows how to do this :)
Thanks
Title: Re: Product Page Fields For Templating
Post by: PRO on October 08, 2012, 13:08:45 pm
Hello,

I would like to show an image on my product page (a "buy" image located somewhere on the server, e.g. "/images/vmimages/buy_image.jpg"), and also I would like that image to be linked with the URL specified in the product information (URL field).

If that requires too much of a coding knowledge, I can satisfy with link pointing to the specified url in the product information.

As far as I know, this code <?php echo $this->product->product_url ?> is showing Product URL as text. I just want that text to be linked with the URL specified in the Product Information.

I hope someone knows how to do this :)
Thanks

<a href="<?php echo $this->product->product_url ?> "><img src="/images/vmimages/buy_image.jpg"/></a>


Title: Re: Product Page Fields For Templating
Post by: sajtfokus on October 08, 2012, 19:01:51 pm
Thank you very much!!!

Any suggestion how to open that link in another window? I want to keep my visitors on website as long as I can :)
Title: Re: Product Page Fields For Templating
Post by: PRO on October 10, 2012, 00:25:14 am
<a href="<?php echo $this->product->product_url ?> " target="_blank"><img src="/images/vmimages/buy_image.jpg"/></a>

Title: Re: Product Page Fields For Templating
Post by: be on November 10, 2012, 23:54:14 pm
Hi,
is there also a field for displaying all used categories for my product?
I have an product in several categories, but with
Code: [Select]
<?php echo $this->category->category_name?>
I got only the actually used category and not all in which these product is sort.

Or is a there a workaround to wrote this information directly from the database?

BR
Title: Re: Product Page Fields For Templating
Post by: csimmo on November 28, 2012, 03:57:12 am
This info was incredibly useful. I am wanting to know how I can edit some of the output.
If you look here: http://www2.abtsystems.com.au/pc-components/cpu/85/39/intel-lga1155/intel-core-i5-3570k-detail.html
With the dimensions, I only want the first 2 decimal spaces
With the estimated dispatch date, I want to have the date format in day/month/year and to loose the time.
With the URL, I want it to apply a hyperlink.

Thanks for any info you can provide
Title: Re: Product Page Fields For Templating
Post by: csimmo on December 08, 2012, 01:46:48 am
Sorry to push, but could some one provide an answer to my question? Someone else has also asked about getting rid of the extra )'s in the measurements.

For the product URL this is my code:
<div class="product-url">
<?php
echo JHTML::link($this->product->product_url, ('Click here for manufacturer product page'));
?>
</div>

but it just points back to the home page.

How do I get it open a new window and follow the url?
Thanks for any help!!
Title: Re: Product Page Fields For Templating
Post by: CenturionSigns on December 20, 2012, 13:53:19 pm
I'll second that request to work out how to format the dimensions with a set number of decimal places (I actually want none.)  Would also like to include the measurement units.

I.e. it currently displays "100.00"  and I would like it to say "100 mm"
Title: Re: Product Page Fields For Templating
Post by: Spyros Petrakis on January 17, 2013, 15:55:14 pm
In the previous version VM 1.1.x there was also available these fields $cdate and $mdate is there something similar for VM2 or i just have to make query for them.   
Title: Re: Product Page Fields For Templating
Post by: PRO on January 17, 2013, 17:01:58 pm
In the previous version VM 1.1.x there was also available these fields $cdate and $mdate is there something similar for VM2 or i just have to make query for them.   

I think created_on

If you look at your database, and the product table.
You can access ANY of the columns  by

$this->column_name

Title: Re: Product Page Fields For Templating
Post by: Flasher on February 01, 2013, 02:56:22 am
Hello All. I have made a lot of things that PRO has posted here but i guess the problem is not the code. I guess the problem is the template itself. I'm using Gavick Pro Boutique Template. Does any one have issues displaying custom fields after or before the price????
Title: Re: Product Page Fields For Templating
Post by: CenturionSigns on February 04, 2013, 17:58:13 pm
Hi!

I have used the info in this thread to add several fields and customize the product details view.

However, how do I add a list of ALL of the categories that a product is in?
Title: Re: Product Page Fields For Templating
Post by: PRO on February 04, 2013, 19:22:27 pm
Hi!

I have used the info in this thread to add several fields and customize the product details view.

However, how do I add a list of ALL of the categories that a product is in?
http://forum.virtuemart.net/index.php?topic=105810.0

Title: Re: Product Page Fields For Templating
Post by: bdimov on April 05, 2013, 16:39:51 pm
Hey,
What is the code for the product manufacturer and I want to display the name of manufacturer and manufacturer picture...
Title: Re: Product Page Fields For Templating
Post by: PRO on April 06, 2013, 03:43:05 am
Hey,
What is the code for the product manufacturer and I want to display the name of manufacturer and manufacturer picture...

Name
<?php echo $this->product->mf_name ?>


and for image
http://forum.virtuemart.net/index.php?topic=95818.30
Title: Re: Product Page Fields For Templating
Post by: Alberto87 on June 14, 2013, 12:55:12 pm
Hello,

if i add the code for the text availability, <?php echo $this->product->product_availability; ?>

can i choose a custom text from the language file ? (en/de/ ecc...)

thanks
Title: Re: Product Page Fields For Templating
Post by: PRO on June 14, 2013, 21:52:30 pm
Hello,

if i add the code for the text availability, <?php echo $this->product->product_availability; ?>

can i choose a custom text from the language file ? (en/de/ ecc...)

thanks

what do you mean?

are you using multi language?

Title: Re: Product Page Fields For Templating
Post by: Alberto87 on June 18, 2013, 15:04:41 pm
Yes, i use virtuemart in multi languages.

I want to know, if for every language I can write/set a specific text.

Right now I have an image and it doesn't change for each language.

Can you please help me?

Thanks!
Cheers,
Alberto
Title: Re: Product Page Fields For Templating
Post by: PRO on June 18, 2013, 19:48:59 pm
Yes, i use virtuemart in multi languages.

I want to know, if for every language I can write/set a specific text.

Right now I have an image and it doesn't change for each language.

Can you please help me?

Thanks!
Cheers,
Alberto

I am asking someone about this, I will see

Title: Re: Product Page Fields For Templating
Post by: Alberto87 on July 01, 2013, 15:43:47 pm
hello,

are there news?
Title: Re: Product Page Fields For Templating
Post by: PRO on July 02, 2013, 22:54:52 pm
Yes, i use virtuemart in multi languages.

I want to know, if for every language I can write/set a specific text.

Right now I have an image and it doesn't change for each language.

Can you please help me?

Thanks!
Cheers,
Alberto

The code below will have 4 different results for availability
It tests for availability values of 1,2,3, and 4

THEN it adds a language string
You can do your own language strings inside your language overrides
http://forum.virtuemart.net/index.php?topic=92944.0

You can even add an image link inside your language override

<?php if ($this->product->product_availability ==1){
echo JText::_('COM_VIRTUEMART_PRODUCT_AVAIL1');}
elseif ($this->product->product_availability ==2){
echo JText::_('COM_VIRTUEMART_PRODUCT_AVAIL2');}
elseif ($this->product->product_availability ==3){
echo JText::_('COM_VIRTUEMART_PRODUCT_AVAIL3');}
elseif ($this->product->product_availability ==4){
echo JText::_('COM_VIRTUEMART_PRODUCT_AVAIL4');}
?>


let me know if this gets you going in the right direction
Title: Re: Product Page Fields For Templating
Post by: Alberto87 on July 03, 2013, 11:36:58 am
Hello,

ok, but where i can add this code?

Code: [Select]
<?php if ($this->product->product_availability ==1){
echo 
JText::_('COM_VIRTUEMART_PRODUCT_AVAIL1');}
elseif (
$this->product->product_availability ==2){
echo 
JText::_('COM_VIRTUEMART_PRODUCT_AVAIL2');}
elseif (
$this->product->product_availability ==3){
echo 
JText::_('COM_VIRTUEMART_PRODUCT_AVAIL3');}
elseif (
$this->product->product_availability ==4){
echo 
JText::_('COM_VIRTUEMART_PRODUCT_AVAIL4');}
?>


can i replace this ?

Code: [Select]
// Availability Image
/* TO DO add width and height to the image */
if (!empty($this->product->product_availability)) {
   $stockhandle = VmConfig::get('stockhandle', 'none');
if ($stockhandle == 'risetime' and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
    ?> <div class="availability">
    <?php echo JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' VmConfig::get('rised_availability''7d.gif'), VmConfig::get('rised_availability''7d.gif'), array('class' => 'availability')); ?>
    </div>
<?php } else {
    
?>

    <div class="availability">
<?php echo JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability$this->product->product_availability, array('class' => 'availability')); ?>
    </div>
<?php
}
}
?>
Title: Re: Product Page Fields For Templating
Post by: PRO on July 03, 2013, 14:24:43 pm


this is the complete availability block


      <?php
      // Availability Image
      $stockhandle = VmConfig::get('stockhandle', 'none');
      if (($this->product->product_in_stock - $this->product->product_ordered) < 1) {
         if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {
         ?>   <div class="availability">
             <?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability'))) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability', '7d.gif'), VmConfig::get('rised_availability', '7d.gif'), array('class' => 'availability')) : JText::_(VmConfig::get('rised_availability')); ?>
         </div>
          <?php
         } else if (!empty($this->product->product_availability)) {
         ?>
         <div class="availability">
         <?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability)) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability, $this->product->product_availability, array('class' => 'availability')) : JText::_($this->product->product_availability); ?>
         </div>
         <?php
         }
      }
      ?>



please make sure to backup your file
Title: Re: Product Page Fields For Templating
Post by: Robert_ITMan on November 07, 2013, 19:25:39 pm
Please help! Availability is not dynamic enough for us - why can't we just use the stock levels? How do we get this to work on product details like we have on category?

category/default.php
Code: [Select]
<span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"><?php echo $product->product_in_stock ?></span> :) works perfectly result example: <span class="vmicon vm2-normalstock" title="Order Now">15</span>

productdetails/default.php
Code: [Select]
<span class="vmicon vm2-<?php echo $this->product->stock->stock_level ?>" title="<?php echo $this->product->stock->stock_tip ?>"><?php echo $this->product->product_in_stock ?></span> >:( does not work result example:  <span class="vmicon vm2-" title="">15</span>
Title: Re: Product Page Fields For Templating
Post by: PRO on November 08, 2013, 00:20:23 am
what do you want to do with availability?

<?php echo $this->product->product_in_stock ?> 
can be used

I use a estimated ship date & estimated delivery date. Then, just store availability by the # of days it takes to ship.

<?php
// Check to ensure this file is included in Joomla!
defined ( '_JEXEC' ) or die ( 'Restricted access' );
$daystoship= $this->product->product_availability;
$daystodelivery= $daystoship + 5;
$ship_date = date('md', strtotime(" + $daystoship Weekdays"));
$estimated_ship_date= $ship_date;
$delivery_date = date('md', strtotime("+ $daystodelivery Weekdays"));
$mo = substr($estimated_ship_date, 0, 2);
$da = substr($estimated_ship_date, 2, 2);
$dmo = substr($delivery_date, 0, 2);
$dda = substr($delivery_date, 2, 2);
$est = $mo . "/" . $da;
$estd = $dmo . "/" . $dda;
?>



then i do on the page
<?php echo JText::_('COM_VIRTUEMART_ESD') ?><?php echo $est; ?></li><li> <?php echo JText::_('COM_VIRTUEMART_ARRIVE') ?><?php echo $estd; ?>

You could easily write your own code to also take into account the # of products in stock
Title: Re: Product Page Fields For Templating
Post by: Robert_ITMan on November 08, 2013, 05:10:40 am
PRO - thanks for quick reply, you inspired me to get it working! This code now works for me so stock in productdetails/default.php is just like we have in category/default.php :)
Code: [Select]
<?php // Stock and Level and Tip
 if ($this->product->product_in_stock 0) {
if ($this->product->product_in_stock <= $this->product->low_stock_notification) {
  $this_stock_level 'lowstock';
  $this_stock_tip JText::_("COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_LOW_TIP");
} else {
  $this_stock_level 'normalstock';
  $this_stock_tip JText::_("COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_NORMAL_TIP");
}
 } else {
  $this_stock_level 'nostock';
  $this_stock_tip JText::_("COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_OUT_TIP");
 } ?>

<span class="vmicon vm2-<?php echo $this_stock_level ?>" title="<?php echo $this_stock_tip ?>"><?php echo $this->product->product_in_stock ?></span>
Title: Re: Product Page Fields For Templating
Post by: bdimov on March 13, 2014, 18:07:02 pm
Hi,

I use this for displaying manufacturer name in product:
<?php echo $this->product->mf_name ?>

My question:
Is there any way to make when I go to product and see that manufacturer name to click and go to manufacturer info page?
I want when I click to manufacturer name to redirects me to manufacturers info page...?
Title: Re: Product Page Fields For Templating
Post by: PRO on April 03, 2014, 01:39:05 am
Hi,

I use this for displaying manufacturer name in product:
<?php echo $this->product->mf_name ?>

My question:
Is there any way to make when I go to product and see that manufacturer name to click and go to manufacturer info page?
I want when I click to manufacturer name to redirects me to manufacturers info page...?

the manufacturer link is standard in vmart product page, IF you choose to show manufacturer
Title: Re: Product Page Fields For Templating
Post by: lliseil on April 07, 2014, 14:35:15 pm
Many thanks to PRO for this topic's information.

To override product details layout and show the stock level image, I use the view file /templates/MYTEMPLATE/html/com_virtuemart/productdetails/default.php
That does not work by simply adding '$this->' to what works for Category page Field overrides. Here's my test:
Code: [Select]
<?php // Stock Info 
echo $this->product->stock_level    // print nothing
echo $this->product->product_availability;   // print nothing 
echo $this->product->product_in_stock   // works
?>

The logic's somehow out of my mind.

But Robert_ITMan's code with '$this_stock_{level,tip}' works beautifully :)

ps : not '$this_product-availabity'.
Title: Re: Product Page Fields For Templating
Post by: tzic on May 02, 2014, 22:05:52 pm
Hello,

I am trying to display "Units in box" in my details page. Is there a way to do it or it is just a dummy entry in Virtuemart?

PS I am not reffering to Product Unit: <?php echo $this->product->product_unit ?>

or Product Weight Unit of Measure: <?php echo $this->product->product_weight_uom ?>

Title: Re: Product Page Fields For Templating
Post by: GJC Web Design on May 02, 2014, 23:54:55 pm
For further reference  "Units in Box" is  <?php echo $this->product->product_box ?>
Title: Re: Product Page Fields For Templating
Post by: kelecz on October 02, 2014, 15:10:11 pm
Hello,

<?php echo $this->product->product_width ?>
<?php echo $this->product->product_height ?>

I succeed in adding this two rows in an override file, but now the numbers are presented like:

Hoogte :60.0000 cm.
Potmaat :17.0000 cm.


How can I present integers instead of the above format?

Like to hear from you,

Tim Hoogland

In your phpAdmin : see picturs


(http://)

[attachment cleanup by admin]
Title: Re: Product Page Fields For Templating
Post by: Robert_ITMan on October 02, 2014, 15:31:42 pm
I succeed in adding this two rows in an override file, but now the numbers are presented like:
Hoogte :60.0000 cm.
Potmaat :17.0000 cm.
How can I present integers instead of the above format?

Do NOT edit your database as kelecz suggested - next VM update will fix your tables and remove this change -  which you will want when calculating shipping costs for better accuracy.

Instead use php number_format to display them as you wish, see: http://php.net/manual/en/function.number-format.php
<?php echo number_format($this->product->product_width, 2, '.', ','); ?> // 60.00
<?php echo number_format($this->product->product_height, 0, '.', ','); ?> // 17
Title: Re: Product Page Fields For Templating
Post by: kelecz on October 02, 2014, 15:58:44 pm
Great,

in which file? I try to do that in my overide defoult.php but nothing.

I will be grateful for help.
Title: Re: Product Page Fields For Templating
Post by: Robert_ITMan on October 02, 2014, 16:09:02 pm
in which file? I try to do that in my overide defoult.php but nothing.
from my earlier post
... productdetails/default.php is just like we have in category/default.php

MAKE SURE you are editing the files in your template! For example copy the file
FROM:
/components/com_virtuemart/views/productdetails/tmpl/default.php
TO:
/templates/(your template)/html/com_virtuemart/productdetails/default.php
Title: Re: Product Page Fields For Templating
Post by: kelecz on October 02, 2014, 16:40:32 pm
Thank you. I did that.
So if I return settings in php to 10,4 it will work with that no matter of update?
Title: Re: Product Page Fields For Templating
Post by: Robert_ITMan on October 02, 2014, 16:46:32 pm
So if I return settings in php to 10,4 it will work with that no matter of update?
Yes exactly - do not edit your database table settings - instead format your display in your template overrides.
Title: Re: Product Page Fields For Templating
Post by: kelecz on October 02, 2014, 21:34:27 pm
I 'll ask this way...
Mine Dimensions and weight code is:
Code: [Select]
<?php if (($this->product->product_length 0) || ($this->product->product_width 0) || ($this->product->product_height 0) || ($this->product->product_weight 0) || ($this->product->product_packaging 0)) { ?>
            <div class="Dimensions">

                <h4><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DIMENSIONS_AND_WEIGHT'?></h4>
                <?php
                
if ($this->product->product_length 0) {
                echo 
'<div>'.JText::_('COM_VIRTUEMART_PRODUCT_LENGTH').': ' .$this->product->product_length.$this->product->product_lwh_uom.'</div>';
                }
                if (
$this->product->product_width 0) {
                echo 
'<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WIDTH').': ' .$this->product->product_width.$this->product->product_lwh_uom.'</div>';
                }
                if (
$this->product->product_height 0) {
                echo 
'<div>'.JText::_('COM_VIRTUEMART_PRODUCT_HEIGHT').': ' .$this->product->product_height.$this->product->product_lwh_uom.'</div>';
                }
echo number_format($this->product->product_weight1'.'',');
                if (
$this->product->product_weight 0)  {
                echo 
'<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT').': ' .$this->product->product_weight.$this->product->product_weight_uom.'</div>';
}
                if (
$this->product->product_packaging 0) {
                echo 
'<div>'.JText::_('COM_VIRTUEMART_PRODUCT_PACKAGING').': ' .$this->product->product_packaging.$this->product->product_unit.'</div>';
                }
                
                if (
$this->product->product_box) {
                
?>

                    <div class="product-box">
                   
                    <?php

and show me this:
..........................................................................
DIMENSIONS AND WEIGHT

10.0
Weight: 10.0000KG
..........................................................................
How can I put code to show me :
...........................................................................................
DIMENSIONS AND WEIGHT

Weight: 10.0 KG
...........................................................................................
We are talking about this code:
Code: [Select]
echo number_format($this->product->product_weight, 1, '.', ',');
                if ($this->product->product_weight > 0)  {
                echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT').': ' .$this->product->product_weight.$this->product->product_weight_uom.'</div>';
}

Thank you in advance



Title: Re: Product Page Fields For Templating
Post by: Robert_ITMan on October 02, 2014, 23:04:18 pm
Look at it closely - I'm sure you would have figured this out yourself:
Code: [Select]
//replace echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT').': ' .$this->product->product_weight.$this->product->product_weight_uom.'</div>';
//with this
echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT').': ' .number_format($this->product->product_weight, 1, '.', ',').$this->product->product_weight_uom.'</div>';
Title: Re: Product Page Fields For Templating
Post by: kelecz on October 03, 2014, 01:06:51 am
Dear Sir,

you are my hero! See http://petproba.konji.rs/konji/product-38-detail

I was really close...  ;D

Thanks again.

Grateful
Title: Re: Product Page Fields For Templating
Post by: lostmail on June 20, 2015, 00:22:06 am
I have this peace of code in templates/mytemplate/html/com_virtuemart/productdetails/default.php :
Quote
<div class="stock-level"><?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP') ?>

                     <?php
            $stato = "";
            $statotip = "";
            if ($this->product->product_in_stock < 1) {
               $stato = "nostock";
               $statotip = "Entschuldigung, wir haben derzeit keine Exemplare dieses Artikels auf Lager";

            } else {
               if ($this->product->product_in_stock < 5) {
                  $stato = "lowstock";
                  $statotip = "Sofort Lieferbar, aber nur noch wenige Exemplare auf Lager!";

               } else {
                  $stato = "normalstock";
                  $statotip = "Sofort Lieferbar!";
                     }
            } ?>
            <span class="vmicon vm2-<?php echo $stato ?>" title="<?php echo $statotip ?>"></div>

            <div class="stock-level">
            <?php

            if ($this->product->product_in_stock < 1) {
               echo  "Nicht auf Lager!";
            } else {
               if ($this->product->product_in_stock < 5) {
               echo "Wenige Exemplare auf Lager!";
               } else {
                  echo "Auf Lager!";
               }
            } ?>
            </div>

After update to VM 2.6.12 it seems the calculation does not work anymore and show false invormation.
A product with stock of 6 pcs and booked/orders 6 pcs has stock "0" - so it should be case 1 "no stock" but it shows that the product ist available and a green bar instead of red..

Why does my code not work proper ?
Title: Re: Product Page Fields For Templating
Post by: GJC Web Design on June 20, 2015, 10:03:06 am
and what when u echo it out is $this->product->product_in_stock  ?
Title: Re: Product Page Fields For Templating
Post by: plyushchev on July 14, 2015, 20:50:54 pm
Hello. How I can get ManufacturerCategory Name?

I create topic about this http://forum.virtuemart.net/index.php?topic=130744.0 (http://forum.virtuemart.net/index.php?topic=130744.0)