News:

Looking for documentation? Take a look on our wiki

Main Menu

Phantom file

Started by YZF, April 20, 2015, 23:20:05 PM

Previous topic - Next topic

YZF

I have been trying to hide the number of items in stock under the Availability section. I received some code from GJC (thanks), edited the file, nothing changed. I made some other minor edits to the file... still nothing changed. I deleted my cache, and even tried a different computer. Still nothing changed.

In my frustration I changed the file name from default.php to default_.php expecting the site to break. Strangely, it continued to work just fine, with no change.

I came to the conclusion that the file I was editing had nothing to do with the live site. So, my question is, how do find this elusive file? 

Here is the file I'm trying to edit: httpdocs/templates/t3_blank/html/com_virtuemart/productdetails/default.php

Sorry if this is a silly question, and thank you for any help.

GJC Web Design

well no  - the site won't break because if u disable the over ride in templates/t3_blank/html/com_virtuemart/productdetails/default.php
it will just go back to using components\com_virtuemart\views\productdetails\tmpl\default.php

this path -> templates/t3_blank/html/com_virtuemart/productdetails/default.php - if your template is 't3_blank' - is correct

did u try using a simple comment to identify where u are?

<!-- I am in this file--->  etc?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

YZF

Thanks GJC; I had no idea that renaming/disabling the default.php file would cause the site to simply revert to a different file - very interesting.

I'm pretty sure t3_blank is right, but at this point, nothing about this site surprises me any more.

I'm not sure I understand the comment suggestion "<!-- I am in this file--->  etc?"

When I worked in regular html files I had lots of comment tags, but php files are different. Where are you suggesting I add the comment tag?

I tried looking at the source code of the live page to see if there was anything like a link to the file it was accessing, but couldn't find anything helpful.

Thank you for your help so far.

GJC Web Design

if the file is all php (unlikely) just add

echo '<!-- I am in this file--->';
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

YZF

Thanks GJC. I'm not sure if this is what you meant, but I added the code you gave me to the default.php file. After uploading the file, I could not see any difference.

-----------------------

// Manufacturer of the Product
            if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
              echo  $this->loadTemplate('manufacturer');
            }
            if ($this->product->product_in_stock >=1) {
            echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="green">'.JText::_('DR_IN_STOCK_NEW').'</i>&nbsp;<b>'.$this->product->product_in_stock.'&nbsp;'.JText::_('DR_ITEMS_NEW').'</b></div>';
            }else {
            echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="red">'.JText::_('DR_OUT_STOCK_NEW').'</i>&nbsp;<b>'.$this->product->product_in_stock.'&nbsp;'.JText::_('DR_ITEMS_NEW').'</b></div>';
            }
            
            echo '<!-- I am in this file--->';
            
            echo '<div class="code"><span class="bold">'.JText::_('DR_PRODUCT_CODE_NEW').':</span>'.$this->product->product_sku.'</div>';

YZF

#5
I thought I found the problem. I noticed a folder called "productdetails_new" beside "productdetails". Inside the folder it looked like identical files. I found a default.php file, so I downloaded it and opened it up. It looked identical to the other default.php file. I tried changing the green in stock text to red and uploaded the file to see if there was a difference. Unfortunately there was no change.

Just to confuse matters more, I found the folder "com_virtuemart_new" and inside that was a "productdetails" folder, containing a default.php which was identical to the other two I modified. Once again I modified that file, and there was no change.

I almost feel like there must be a fourth default.php file which is the one being used (I searched; there isn't).

Frans D

Text colours and so on are determined by the css files, so it has no use trying to change that within a php file.

I usually put an extra text with the path and file name within a language string, or after a php code.
For example;
<?php
    
// PDF - Print - Email Icon
    
if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_button_enable')) {
?>
templates-t3blank-html-comvm-proddet-defaultphp

VM will show the text at the top of the product details page.

Do the same with the other product details default.php files (of course adjust the path description) and you should see which file is appearing.


YZF

Thanks Frans,

I agree that CSS is usually used for colours etc, but since the php file has the code to show products that are In Stock as "green" and Out of Stock to be displayed in "red", I just changed the code so that In Stock was also red.

I noticed in your code sample you wrote: templates-t3blank-html-comvm-proddet-defaultphp.

It looks quite different than: templates/t3_blank/html/com_virtuemart/productdetails/default.php

I am more of a graphic artist than a coder, so I'm not sure what you meant. Should I paste that code string in my default.php page somewhere?

Frans D

It's not a code, just text to show you when it appears; which file it is and were you can find it.
You can also just put the whole path instead if you want, like.
<?php
    
// PDF - Print - Email Icon
    
if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_button_enable')) {
?>
templates/t3_blank/html/com_virtuemart/productdetails/default.php


I've tested it and when you put it after the php code for the pdf, print and email button, it will show at the product details page.

YZF

#9
Hi Frans,

I pasted the URL text exactly where you said in all three default.php pages, and after I uploaded them one by one, there was no difference. The URL text I added did not show up.

As I said, it's almost like there is a mysterious fourth version that is the right live one.

Frans D

Are you sure you assigned Virtuemart to the T3_blank template?

Either way, what happens with the product details page, if you rename the folder com_virtuemart in templates/t3_blank/html/com_virtuemart
Which template are you using?

YZF

#11
Hi Frans,

When I changed "com_virtuemart" to "com_virtuemart_" the site looked all screwed up, so I changed it back and everything looked fine again.

Frans D

Now do the same with the folder templates/t3_blank/html/com_virtuemart/productdetails
What happens now with the product details page?

YZF

#13
Once again, when I changed "productdetails" to "productdetails_" the details page looked all screwed up.

Based on the following two directory name change results, I can assume that the default.php page being used must be the one that is in the directory templates/t3_blank/html/com_virtuemart/productdetails, and not in the other two folders with _new in the name. Which brings me back to the original question, why doesn't the page look different when I modify the default.php file?

Frans D

What are your settings @ BE > VM > configuration > Templates > Shop front settings?