Author Topic: Product Page Fields For Templating  (Read 152894 times)

Alberto87

  • Beginner
  • *
  • Posts: 28
Re: Product Page Fields For Templating
« Reply #60 on: July 01, 2013, 15:43:47 pm »
hello,

are there news?

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10330
  • VirtueMart Version: 3+
Re: Product Page Fields For Templating
« Reply #61 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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Alberto87

  • Beginner
  • *
  • Posts: 28
Re: Product Page Fields For Templating
« Reply #62 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
}
}
?>

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10330
  • VirtueMart Version: 3+
Re: Product Page Fields For Templating
« Reply #63 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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Robert_ITMan

  • Jr. Member
  • **
  • Posts: 114
    • websites developed and managed @ ourfingertips.com
  • VirtueMart Version: 3.2.12 and 3.2.15
Re: Product Page Fields For Templating
« Reply #64 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>
www.ourfingertips.com - websites developed and managed @ ourfingertips

Let me help you make the most of the technology at our fingertips

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10330
  • VirtueMart Version: 3+
Re: Product Page Fields For Templating
« Reply #65 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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Robert_ITMan

  • Jr. Member
  • **
  • Posts: 114
    • websites developed and managed @ ourfingertips.com
  • VirtueMart Version: 3.2.12 and 3.2.15
Re: Product Page Fields For Templating
« Reply #66 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>
www.ourfingertips.com - websites developed and managed @ ourfingertips

Let me help you make the most of the technology at our fingertips

bdimov

  • Jr. Member
  • **
  • Posts: 82
  • VirtueMart Version: 2.0.24
Re: Product Page Fields For Templating
« Reply #67 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...?

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10330
  • VirtueMart Version: 3+
Re: Product Page Fields For Templating
« Reply #68 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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

lliseil

  • Beginner
  • *
  • Posts: 34
  • Man is Web's future.
    • LLiseil Web services e-Commerce Virtuemart
  • VirtueMart Version: 2.0.26
Re: Product Page Fields For Templating
« Reply #69 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'.
- A thread solved is a thread [SOLVED]! (a memo for myself)

tzic

  • Jr. Member
  • **
  • Posts: 59
Re: Product Page Fields For Templating
« Reply #70 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 ?>


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8892
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Product Page Fields For Templating
« Reply #71 on: May 02, 2014, 23:54:55 pm »
For further reference  "Units in Box" is  <?php echo $this->product->product_box ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kelecz

  • Beginner
  • *
  • Posts: 49
    • Staffy
Re: Product Page Fields For Templating
« Reply #72 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




[attachment cleanup by admin]
staffy.mrpet.rs

Robert_ITMan

  • Jr. Member
  • **
  • Posts: 114
    • websites developed and managed @ ourfingertips.com
  • VirtueMart Version: 3.2.12 and 3.2.15
Re: Product Page Fields For Templating
« Reply #73 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
www.ourfingertips.com - websites developed and managed @ ourfingertips

Let me help you make the most of the technology at our fingertips

kelecz

  • Beginner
  • *
  • Posts: 49
    • Staffy
Re: Product Page Fields For Templating
« Reply #74 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.
staffy.mrpet.rs