News:

Looking for documentation? Take a look on our wiki

Main Menu

Change ProductDetails image positioning

Started by webbus, September 18, 2012, 21:39:29 PM

Previous topic - Next topic

webbus

Good evening,

i'm trying to change a positioning of a image in product description page. I want it to be in separate DIV's in the left of the page, like a sidebar. Image in the left DIV. All descriptions, "Add to card" etc - on the right DIV.

What i tried to do is open "public_html/components/com_virtuemart/views/productdetails/tmpl/default.php", then i found a php code which includes image:

<?php
echo $this->loadTemplate('images');
?>


So i put this code where i need image to appear, in the left DIV. But unfortunately after doing so, i'm getting this error on page:

Parse error: syntax error, unexpected T_VARIABLE in ....../public_html/components/com_virtuemart/views/productdetails/tmpl/default.php on line 56

Then on this forum i have found a thread "Product Page Fields For Templating", and there are PHP codes for images:

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

[b]Additional Images (>1 means all images past the 1st image)[/b]
      <?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"'
         
}
}
?>


But when i put this code where i need in default.php file, i get the following error:

Parse error: syntax error, unexpected $end in ........./public_html/components/com_virtuemart/views/productdetails/tmpl/default.php on line 323

I am well familiar with VM, HTML and CSS, but have very little knowledge in PHP. Is there anything i'm doing wrong? Or maybe there is some other solution?

PS: I am not using template override, but changing original default VM files instead.

Joomla 2.5.6
VM 2.0.10

Thank you in advance for any help.

webbus

Ok, i solved it by my self.

I dont know why, but when i used this code, it worked:

<?php  echo $this->loadTemplate('images');?>

But did not work with such:

<?php  

echo $this->loadTemplate('images')

;
?>


All SOLVED.

jenkinhill

Quote from: webbus on September 18, 2012, 21:39:29 PM

PS: I am not using template override, but changing original default VM files instead.


Is there some reason why you want your layout to break when you next update VirtueMart? Soon we will have 2.0.12 which will overwrite the original files, but will not alter overrides.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

bytelord

Hello,
As jenkinhill suggests you should use template overrides because any time you upgrade vm you will loose any changes you made.
btw, the ";" should be at the end of the line, not in the next line
<?php 

echo $this->loadTemplate('images');

?>

but what you did is the same and right

good luck!
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

webbus

Thank you guys.

I will definitely use overrides then. I must admit i didnt though abot updates so i didint bothered to use them.

Thank you very much again.