Post by straightlight » Wed Oct 25, 2017 7:36 am

I have sent you a PM.

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 print-n-tees » Wed Oct 25, 2017 7:48 am

I did not get one from you... I sent you one in return... sitting in outbox??

Heres something else I did... I went in and changed out journal2 as the theme and back to default... and I edited the default template to include the new call for the discounted price. Refreshed all caches etc. And still did not show on the default page.

WTF? How do you guys get so good at this stuff. This drives me crazy.

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by straightlight » Wed Oct 25, 2017 7:49 am

I received your PM. To ensure you are looking at the right location, go to the top-right of the page, you will notice your username. Click on it. Then, go to the Private Messages tab. You should see your messages list on that page.

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 straightlight » Wed Oct 25, 2017 7:50 am

You are using Journal2. At the bottom-left of the admin section, you should see a link to clear out the Journal2 cache.

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 print-n-tees » Wed Oct 25, 2017 7:51 am

Yup. you got my message and replied and I replied to you. :)

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by print-n-tees » Wed Oct 25, 2017 7:53 am

Yes I did that too. And in the system setting I turned off the cache system.

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by straightlight » Wed Oct 25, 2017 8:03 am

Might be an issue with the Journal2. Contact the publisher regarding a cache 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 print-n-tees » Wed Oct 25, 2017 8:04 am

But even not using journal2 i still dont get it to work on the default theme.

Sent you a PM.

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by print-n-tees » Wed Oct 25, 2017 8:58 am

Is it possible for me to create another template... say product2 and then in the product admin page... where it asks for the design... to be able to select product2 and it would use product2 template file? Im thinking being I have no problems with the template cache... I can just hard code the secondary template with the information I need and on the products that I need this edit for... I can just point them to that template and that would work for me too.

Angelina

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by straightlight » Wed Oct 25, 2017 9:03 am

It would not make any difference on that end since the TWIG engine is centralized through the platform no matter which controller needs to load those templates.

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 print-n-tees » Wed Oct 25, 2017 9:12 am

Hmmm Maybe i did not explain it right.

I can easily modify the templates and it shows what I want it to on the client side. My cache issue is not with the templates. So I was thinking I can make a whole new template... lets call it... product-discounted.twig in the same directory as product.twig. So I will have 2 product templates. This new template I can put in the pricing as I need it... as this feature will just be used for one style of products... and I will not be using the discounts on other products. So essentually I wanna make a second template just for that group of products... which will already have a nice little table with pricing built in for showing on clients side and will not reply on the controller file for pricing. understand ?

In the product admin... the last tab is for design. Could i use that somehow to select the design I want to use so for this product I would wanna call in that second template. Is that possible?

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by straightlight » Wed Oct 25, 2017 9:19 am

I would not suggest that approach to duplicate a product page for a single feature since it could affect the search engine's results since the search engine on your site will still point to the original product page. In addition, it would also affect the search bots from the search engines with duplicated content except for one feature since you'd be looking to use the design tab in this case. The issue is with Journal2 cache obviously. Even though you switch back to the default theme does not prevent Journal2 on maintaining its operations globally throughout the platform as it already does. I would rather suggest to try a fresh copy of Opencart either on a virtual server or on your domain to a separate folder and try the modifications from the previous page noticing if the same issue persists after clearing all caches.

For testing purposes, you'd save a lot of time using this approach.

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 print-n-tees » Wed Oct 25, 2017 9:33 am

I will try that I guess tomorrow on a fresh install. Although this was a fresh install too. Fresh for both... but I did add a few small modules. But I will try to build it out tomorrow with a new server totally fresh and see what I get. Thank you for all your help.

Angelina

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by straightlight » Wed Oct 25, 2017 9:52 am

A fresh install means that no extensions at all are installed (including Journal2) as well as using Opencart the way the features are currently handled from the core once the files have been deflated from the ZIP file and the database being successfully added on the database.

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 print-n-tees » Wed Oct 25, 2017 10:01 am

OMG I was able to do this on my 1.5.6 install with PHP.

See: http://wrappedcandybars.com/1234

It was very easy using PHP.

Code: Select all

<?php
$first =  substr($discount['price'],1);;
$second = .80;
$operation = "*";
$answer = eval('return '.$first.$operation.$second.';');
echo $answer;
?>
Now I have to figure out how to make round to the nearest penny or 2 decimal spots.

And then figure out how to convert to twig. lol

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by print-n-tees » Wed Oct 25, 2017 10:02 am

straightlight wrote:
Wed Oct 25, 2017 9:52 am
A fresh install means that no extensions at all are installed (including Journal2) as well as using Opencart the way the features are currently handled from the core once the files have been deflated from the ZIP file and the database being successfully added on the database.
Yea I will try a new install fresh on a new sub-domain.

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by print-n-tees » Wed Oct 25, 2017 10:06 am

Here is the code rounded to to the 2nd decimal position:

Code: Select all

<?php
$first =  substr($discount['price'],1);
$second = .80;
$operation = "*";
$answer = eval('return '.$first.$operation.$second.';');
echo round($answer, 2);
?>
Why cant twig be this easy??

Is there a way for me to add PHP code into a twig template?... while using twig variables?

Something like:

Code: Select all

<?php
$first =  substr({ $discount.price },1);
$second = .80;
$operation = "*";
$answer = eval('return '.$first.$operation.$second.';');
echo round($answer, 2);
?>

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by straightlight » Wed Oct 25, 2017 10:21 am

In a controller, all you'd need to do is this:

Code: Select all

$first =  substr($discount['price'], 1);

$second = .80;

$operation = "*";

$answer = eval('return ' . $first . $operation . $second . ';');

$data['answer'] = round($answer, 2);
Then, in the associated TWIG file:

Code: Select all

{% if answer %}
{{ answer }}
{% endif %}
Last edited by straightlight on Wed Oct 25, 2017 10:25 am, edited 2 times in total.

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 print-n-tees » Wed Oct 25, 2017 10:23 am

Thats the problem!!! Cant seem to edit the controller or the cache wont work. I will see on the new install tomorrow. :) I will advise.

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm


Post by print-n-tees » Thu Oct 26, 2017 2:36 pm

Hey guys... ok I created a new account, actually I did 2 of them. And i can confirm that journal2 theme is definitely messing around with the cache somehow. after i created a new account and did a fresh install of opencart... i tried editing the controller product.php file. and while i was able to see the changes instantly... the codes you both provided did not work at all. but i will get to that in a bit... but i was able to edit the controller file and see the changes take affect. so that was good.

I then reverted the changes back to standard file and test and the changes were no longer there as to be expected. So i then loaded journal2 and turned it on. Then i went to edit the controller file again and could not get the changes to take effect no matter what i tried. clearing cache, changing browsers, changing devices etc.

So Straightlight... you were correct in thinking that journal was messing something up. I messaged the developer and they are saying that there's nothing wrong.... so I bought hosting on a totally different server from a different company... and did a fresh install of opencart. Again was able to play with the controller file and changes took effect. again when i put on journal2 changes no longer took effect. Its wierd cause the file shows the changes but you dont see the effects of the changes on the front end.

So yes... journal has a weird cache thing going on.

As for the code... It took me a while to play with it and I figured out what I had to do to get it to work in the controller:

Code: Select all

'after_discount'     => number_format((($discount['price']) * 0.80), 2)
and in the products template I just need to call: discount.after_discount and it works!!!

Now I know if I start all over again with my website... I can change the controller file prior to installing journal... but then after I do I cant change it... so if the discount changes... Im basically screwed. So I gotta try to figure out a way to do this within the template file like I did on my 1.5.6 install.

Angelina

User avatar
New member

Posts

Joined
Sun Feb 24, 2013 2:54 pm

Who is online

Users browsing this forum: No registered users and 1 guest