Post by tjonnyc » Fri Sep 15, 2017 10:02 pm

If I go into Admin -> Design -> Theme Editor -> product.twig, and make a test change (adding an H1), then save & reload the front-end, the change shows up.

However, if I open the FILE /catalog/view/theme/default/template/product/product.twig - the change is NOT there.

So, 2 questions:

1.) If the change that's made in admin is NOT saved in the FILE, then WHERE is it saved????
2.) If it's saved somewhere else, why is there a template file, if it does nothing?

Active Member

Posts

Joined
Tue Dec 21, 2010 5:05 am

Post by yodapt » Fri Sep 15, 2017 10:16 pm

Have you checked the database?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by tjonnyc » Fri Sep 15, 2017 10:24 pm

Just did. And yes, there's a table "oc_theme", with a single entry that contains the "new" product.twig, with my change.

Which REALLY makes me wonder.... WHY. IS. THERE. A. TEMPLATE. FILE. THEN.

And how the hell is this all supposed to work now? Do we change the template file, or the code in the admin?

It's like the OC developers decided "hey, you know how, like, people were used to making changes to the template FILES, and learned PHP code, etc? Guess what? Now we're going to store SOME changes in files, and SOME in database, and good frickin' luck trying to figure out what's where."...

Active Member

Posts

Joined
Tue Dec 21, 2010 5:05 am

Post by Qphoria » Fri Sep 15, 2017 10:54 pm

Which REALLY makes me wonder.... WHY. IS. THERE. A. TEMPLATE. FILE. THEN.
Don't use dramatic sentences when you don't understand something.. makes you sound like a moron. Files are there because up until you made that change.. where did you expect the template to exist? The database holds the overrides to theme only.. similar to how ocmod and vQmod work.. you have your base, then an override script to find/replace just the parts you want to change. Doesn't make sense to hold full themes in a database.. only the overridden lines. Remember the definition of a "template" is "a preset format for a document or file, used so that the format does not have to be recreated each time it is used." So you shouldn't be editing templates directly anyway.

If you do alter twig files directly, you won't see the changes initially because twig uses a template cache. It's hidden on the dashboard for some reason but if you look at the little gear icon on the right side near the top, that is the template cache clear. So if you make changes to the twig files directly, you will need to clear the cached version for those changes to take affect. The overrides in the admin will always take effect on the cached file version.

The purpose of this is 1) for the cloud version of OpenCart, it allows customers to make changes to their own cart, based off a common code baseline. If they make a mistake they can simply remove their custom overrides and go back to the default. 2) You don't have to worry as much about losing custom changes to files when you upgrade opencart on your own server. You can go back and reference the changes you made as they are saved in the database.

Sometimes (almost always in my case ;D ) the developers know the better method.

You should try when possible to never alter files and only use overrides... that's just a general rule to life.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by alexmath » Sat Oct 21, 2017 8:59 am

I was enjoying this discussion till i reached the gear on the admin dashboard. I have read many discussions about this topic: I have deleted the cache in the system storage, cleared the cache using the gear, cleared vqmod cache, but still the code from the vqmod wont be executed for product.twig. The product_form.twig, however is working fine. So am completely out of options here. If i edit it directly in the theme-editor, it works fine. What could i be missing or doing wrong.
I have code equivalent to this:

In the vqmod

Code: Select all

<file path="catalog/view/theme/default/template/product/product.twig">
		<operation>
			<search><![CDATA[<div id="product"> {% if options %}]]></search>
			<add position="before"><![CDATA[
				 {% if my_var %}
                     <div class="form-group">
				 <h2><a href="{{ my_var}}" > {{ my_var_desc }} </a></h2>
          </div>
          {% endif %}
			]]></add>
		</operation>
	</file>
Where I want to add the code in the product.twig file:

Code: Select all

{% for discount in discounts %}
            <li>{{ discount.quantity }}{{ text_discount }}{{ discount.price }}</li>
            {% endfor %}
            {% endif %}
          </ul>
          {% endif %}
          
          {# Insert the code above Right Here #}
         
          <div id="product"> {% if options %}
            <hr>
            <h3>{{ text_option }}</h3>
            {% for option in options %}
            {% if option.type == 'select' %}
            <div class="form-group{% if option.
thanks.

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sat Oct 21, 2017 10:07 am

If the system/storage has been moved to another directory from the admin annoying modal window in the dashboard page, it is possible that you may encounter some problems. However, by keeping the system/storage folder at the same location in your config.php and admin/config.php file as the original installation of Opencart provides, you should not encounter any issues.

Also ensure to assign proper permissions recursively to the system/storage folder as per the install.txt file indicates from the original ZIP file of Opencart. In addition, all caches should be cleared out, including browser cache. Overall, there are three caches that are recommended to be cleared when using TWIG files.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sat Oct 21, 2017 7:00 pm

@straighlight, thanks. I moved the storage folder right after installation as recommended by opencart, and i confirmed that the paths in both config files are correct. Should i still re-move the storage folder to have the system/storage structure? rightnow i develop locally using xampp. and am logged in as admin so i dont think there are permission issues, though i experience problems when i try to download data straight from the catalog, say catalog/image1.png. can that be the cause?
None the less, am going to first clear the three caches at once for now. till u get back to me with the storage structure.

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sat Oct 21, 2017 9:04 pm

There is nothing to move or to remove ... simply change the path to the original system/storage folder from your config.php and admin/config.php file.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sat Oct 21, 2017 10:18 pm

I did all the above but the issue persists. what should i try next?

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sat Oct 21, 2017 10:19 pm

Clear all caches.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sun Oct 22, 2017 1:42 am

system/storage/cache, dash board gear, browser clear data, vqmod cache all cleared.
I have noticed something though, there's no file corresponding to the product.twig file in the vqmod so i dont think that part is being seen at all. i dont know why. There are files corresponding to all other files modified by the vqmod except that one. could that be it? if so how do i resolve that?

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sun Oct 22, 2017 1:52 am

If you do not see the product.twig file in your VQCache and one of your XML searches for a line on this file, look in the VQMod Manager for reported errors.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sun Oct 22, 2017 2:46 am

which vqmod manager? If you are talking about the vqmod/logs. its empty, there are no errors there concerning this issue. If there's another manager am not aware of then am all ears :)

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sun Oct 22, 2017 2:49 am

Since you're working on a virtual platform, there isn't much information I can provide about this. However, this issue is related to a line search from one of the XML that is not able to track the proper information in order to add what it needs at that specific location in the TWIG file.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sun Oct 22, 2017 3:07 am

ok, so does trying to change the used option help, say instead of before, I use after with an offset? or simple put the data at a different location? Coz if any of them works, its ok with me. or does doing any of the above have absolutely nothing to do with the current problem? If so I will have no choice but to simply alter the core files. I have come to like vqmod so much though :). its really awesome and efficient when dealing with multiple files.

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sun Oct 22, 2017 3:09 am

If the XML file was downloaded from a publisher, simply contact the publisher to resolve this issue.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sun Oct 22, 2017 3:43 am

no, I wrote it myself. But the thing's all other parts are working fine in the same file. Also if there was a problem, it would log normally. since its not logging then i assumed there were no errors.
Oh, do you mean the vqmod itself? Ah in that case i will contact them asap. I guess i misunderstood you there :).

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sun Oct 22, 2017 3:45 am

Also if there was a problem, it would log normally. since its not logging then i assumed there were no errors.
Then this analogy is incorrect. Users can still encounter errors without having any logs recorded on file. Since the reported issue is about an extension you are trying to build as it has nothing to do with the Opencart core and that you are using virtual tools, the solutions would be quite limited on this end.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexmath » Sun Oct 22, 2017 3:49 am

but thats not the only thing. even if i put the exact code that works in the admin dashboard directly into the product.twig file. it's still the same problem. So i dont think the issue is just the vqmod really.

New member

Posts

Joined
Sat Sep 23, 2017 7:35 am

Post by straightlight » Sun Oct 22, 2017 3:50 am

Core files should not be modified. However, if you do modify TWIG files, ensure to clear all caches including the ones from the extensions.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 24 guests