VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Leneux on August 09, 2012, 00:21:50 AM

Title: So I messed up a default.php file...
Post by: Leneux on August 09, 2012, 00:21:50 AM
I was trying to increase the character count of the product short description, and somehow totally screwed it up.  I'm not sure exactly how I screwed it up, it should have been a very simple change in the code.
I didn't make a backup of the file, because I figured I could just ctrl+z - well the jokes on me.

The file I was attempting to change was...

/components/com_virtuemart/views/category/tmpl/default.php

the line of code I altered was...

<?php // Product Short Description
   if(!empty($product->product_s_desc)) { ?>
   <p class="product_s_desc">
   <?php echo shopFunctionsF::limitStringByWord($product->product_s_desc, 40, '...') ?>
                  </p>
                  <?php } ?>

...I changed the '40' to '500', to allow for more character spaces - at least I thought.  But when I made the change, and saved the file - the whole darn thing flipped on its backside, and I don't even recognize the code anymore.  Ctrl+z wouldn't even undo my error... I shouldn't have used notepad i guess.

So my question is, do I now have to uninstall all the VM extensions and reinstall, fresh, to make it right again?  Doing so wouldn't be a huge problem, since I haven't really started on any content for the store yet.  Or does anyone have any other suggestions on how to fix this?

Also, and more importantly, what the heck did I do wrong???  I have very little experience with PhP and MySQL databases, but I understand it all.  Should I have used Notepad++ or Dreamweaver instead?  Why would Notepad flip out on a PhP file like that?  Or did I just plain do something incorrect.

I appreciate everyone taking the time to read my questions, I eagerly await your responses...


Joomla! Version 2.5 / VM2
Title: Re: So I messed up a default.php file...
Post by: ivus on August 09, 2012, 04:23:40 AM
Hi Leneux,

2 solutions...


You shouldn't need to re-install VM. BUT if these solutions don't work, you may have another underlying issue. Be sure to check your error.log.

Good luck.  ;D
Title: Re: So I messed up a default.php file...
Post by: Leneux on August 09, 2012, 15:48:19 PM
Excellent!  I'm back in business.

I did toy with that idea, but figured there is no way it would be compatible with all the changes I've made so far - I didn't think it would be the "same" file anymore.  But it is!
Thank you so much for your help :)

P.S. I realize now I should have probably posted this in the general channel, as this one focuses on problems Virtuemart causes, rather than the ones that I do. lol apologies.
Title: Re: So I messed up a default.php file...
Post by: Leneux on August 09, 2012, 16:05:21 PM
One additional update...

I just succeeded in changing short product description from 40 characters to 500.  The problem was that I was using regular Notepad to make changes to the default.php file.  So if I've learned anything through all this its Notepad++, Dreamweaver or nothing.  Don't edit PhP files with Notepad.
Title: Re: So I messed up a default.php file...
Post by: Milbo on August 09, 2012, 19:58:51 PM
yes, notepad++ is quite nice, but I like the notepad2 more.
and next time, use this http://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_template_system.