Post by pratikshah » Wed Oct 14, 2015 1:00 pm

Hello all,

I am using a theme that I bought from themeforest.net called "coolbaby";

I am trying to make some changes to a file called "_ajax_view-product.php" located at "catalog/view/theme".
But the changes are not being reflected. In vqmod cache folder there is no instance of this file created, neither there is any error log created. I wonder what is it that is blocking this file edits;

I tried to get support from the theme developer but unfortunately they doesn't want to help with this issue. They keep saying xml is wrong. I see nothing wrong with the xml. Other mods (even from theme template) work absolutely fine.
Below is the content of xml file for reference;

Any help is appreciated. Thanks in advance.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<id>Custom Edits</id>
	<version>1.0</version>
	<vqmver>2.X</vqmver>
	<author>Pratik Shah, Corel Insight</author>
	
	<file name="catalog/view/theme/*/template/product/product.tpl" error="log">
	
		<operation>
			<search position="replace"><![CDATA[
				<?php $class = 'col-sm-4'; ?>
				]]></search>
				<add trim="true"><![CDATA[
					<?php $class = 'col-sm-8'; ?>
				]]></add>
		</operation>
		
		<operation>
			<search position="before"><![CDATA[
				<?php if ($points) { ?>
				]]></search>
				<add trim="true"><![CDATA[
					<span class="price-tax">Price inclusive of all taxes.</span><br />
				]]></add>
		</operation>
		
		<operation>
			<search position="before"><![CDATA[
				<?php if ($discounts) { ?>
				]]></search>
				<add trim="true"><![CDATA[
					<br />
				]]></add>
		</operation>
		
		<operation>
			<search position="replace"><![CDATA[
				<button class="btn btn-cool btn-lg" type="submit" id="button-cart" data-loading-text="<?php echo $text_loading; ?>"><i class="icon flaticon-shopping66"></i><?php echo $button_cart; ?></button>
				]]></search>
				<add trim="true"><![CDATA[
					<button class="btn btn-cool btn-lg" type="submit" id="button-cart" data-loading-text="<?php echo $text_loading; ?>"><?php echo $button_cart; ?></button>
				]]></add>
		</operation>
		
		<operation>
			<search position="after"><![CDATA[
				<?php echo $discount['quantity']; ?><?php echo $text_discount; ?><?php echo $discount['price']; ?>
				]]></search>
				<add trim="true"><![CDATA[
				<br />
				]]></add>
		</operation>
	</file>
	
	<file name="catalog/view/theme/_ajax_view-product.php" error="log">
	
		<operation>
			<search position="before"><![CDATA[
				product-view-compact
				]]></search>
				<add trim="true"><![CDATA[
					<!-- Go to www.addthis.com/dashboard to customize your tools --><script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5612b9748f80f9a5" async="async"></script>
				]]></add>
		</operation>
		
		<operation>
			<search position="after"><![CDATA[
				if (isset($_GET['stock'])){$stock = $_GET['stock'];}
				]]></search>
				<add trim="true"><![CDATA[
					if (isset($_GET['text_stock'])){$text_stock = $_GET['text_stock'];} else {$text_stock = 'Availability:';}
				]]></add>
		</operation>
		
		<operation>
			<search position="replace"><![CDATA[
				<p><span><strong><?php echo $stock; ?></strong></span> <span><?php echo $text_tax.$product_tax; ?></span></p>
				]]></search>
				<add trim="true"><![CDATA[
					<br /><span class="price-tax">Price inclusive of all taxes.</span><br /><p><?php echo $text_stock; ?> <strong><?php echo $stock; ?></strong></p>
				]]></add>
		</operation>
		
		<operation>
			<search position="replace"><![CDATA[
				<i class="icon flaticon-shopping66"></i><?php echo $view_details; ?>
				]]></search>
				<add trim="true"><![CDATA[
					<?php echo $view_details; ?>
				]]></add>
		</operation>
	</file>
</modification>

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm

Post by IP_CAM » Thu Oct 15, 2015 1:42 am

FIRST: It seems, that you do NOT use a VqMod Version v.2.5.x , or then, change to:
<vqmver>2.5.1</vqmver> , to make VqMod work, because you semengly use V2, according to the CSS-shown!
---
in:
catalog/view/theme/DEFAULT/template/product/product.tpl
as well as in:
catalog/view/theme/YOUR_CUSTOM_THEME/template/product/product.tpl

find this:

Code: Select all

<?php $class = 'col-sm-4'; ?>
absolutely exactly, as it is WRITTEN

and this:

Code: Select all

<?php if ($points) { ?>
absolutely exactly, as it is WRITTEN

and this:

Code: Select all

<?php if ($discounts) { ?>
absolutely exactly, as it is WRITTEN

and this:

Code: Select all

<button class="btn btn-cool btn-lg" type="submit" id="button-cart" data-loading-text="<?php echo $text_loading; ?>"><i class="icon flaticon-shopping66"></i><?php echo $button_cart; ?></button>
absolutely exactly, as it is WRITTEN

and this:

Code: Select all

<?php echo $discount['quantity']; ?><?php echo $text_discount; ?><?php echo $discount['price']; ?>
absolutely exactly, as it is WRITTEN

AND MAKE SURE, there is NO WHITE SPACE ANYWHERE, between

Code: Select all

<search position="after"><![CDATA[
and:

Code: Select all

]]></search>
like, possibly existing HERE, on the image, BEFORE OR AFTER THE CONTENT, to be MODIFIED
Image

I usually RE-write this line like THIS, as ONE-LINER, just, to make absolutely sure:

Code: Select all

<search position="after"><![CDATA[<?php echo $discount['quantity']; ?><?php echo $text_discount; ?><?php echo $discount['price']; ?>]]></search>
IF all lines match, EXACTLY, then, it should function, but if ANYTHING is written differently,
you have to ADD the ANCHOR/TAG - CONTENT from your THEME FILE, into the VqMod,
place it, instead of the not SOURCE CODE matching, incorrect VqMod line/content, to make it work.

It's not so complicated, as it may sound! ;)
Good Luck
Ernie
bigmax.ch/shop/

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by artcore » Thu Oct 15, 2015 2:24 am

remove the error="log" part from the file tag, and add it to the operation tag. That's where it belongs.
Might solve it ;)

Code: Select all

<file name="catalog/view/theme/*/template/product/product.tpl">
      <operation error="log">

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by pratikshah » Thu Oct 15, 2015 12:22 pm

Hello IP_CAM,

I have copy-pasted the lines an are exactly same as in the source file;

The lines that you have quoted are all from the file product.tpl which is having no issues and all those mods are working absolutely fine; The problem is with the second file called "_ajax_view-product.php" that is not at all working. vqmod cache doesn't even create this file in the first place;

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm

Post by pratikshah » Thu Oct 15, 2015 12:24 pm

artcore wrote:remove the error="log" part from the file tag, and add it to the operation tag. That's where it belongs.
Might solve it ;)

Code: Select all

<file name="catalog/view/theme/*/template/product/product.tpl">
      <operation error="log">
Hello artcore,

The error=log can also be used with file tag as per vqmod.com documentation; But I will still try and see if it works;
I am not facing any issues with the file that you have quoted; the mods in the product.tpl file are working fine; The problem lies with the second file as quoted in my previous post;

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm

Post by artcore » Thu Oct 15, 2015 2:26 pm

I stand corrected!
Wildcard paths will ignore the "error" attribute completely
So maybe try to put the theme name without the * and see if the error log has anything this time...

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by pratikshah » Thu Oct 15, 2015 3:41 pm

artcore wrote:So maybe try to put the theme name without the * and see if the error log has anything this time...
The file that does not work doesn't have * in the path;

Code: Select all

<file name="catalog/view/theme/_ajax_view-product.php" error="log">

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm

Post by artcore » Thu Oct 15, 2015 5:24 pm

Is the path really /theme ?
I can take a look if you want pm me :)

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by pratikshah » Thu Oct 15, 2015 5:47 pm

artcore wrote:Is the path really /theme ?
Yes, correct. That is the correct path of the file; The theme is called coolbaby which is a separate folder under theme;
Check the snapshot from filezilla.

Image
artcore wrote:I can take a look if you want pm me :)
Thank you but unfortunately I am not authorized to share any credentials.

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm

Post by artcore » Thu Oct 15, 2015 6:00 pm

No problem. I'll try to recreate your setup and see what comes up.

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by artcore » Thu Oct 15, 2015 6:20 pm

OK, had coffee :)

vQmod comes into play AFTER you opened the relevant page. This file is called via AJAX so I'm not sure if that'll count.
If not you're only bet (until someone proves me wrong) is to copy the file and hard code the changes.

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by pratikshah » Thu Oct 15, 2015 11:31 pm

Sounds logical. Many thanks for all the efforts.

Off-topic this one... but is it possible to get the final total to be rounded up to nearest number as shown in picture by?

Image

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm

Post by artcore » Fri Oct 16, 2015 12:32 am

No problem. As for the other question, look at catalog/model/total/total.php
Untested from the top of my head, but this should work or maybe using floor() even. I rely on my IDE hints ;D

Code: Select all

printf('%.2f', round($total, 0));

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by pratikshah » Fri Oct 16, 2015 2:39 am

artcore wrote:No problem. As for the other question, look at catalog/model/total/total.php

Code: Select all

printf('%.2f', round($total, 0));
Hey, got it working! Many thanks again...

Used this code in vqmod and it seems to be working fine; Will test for couple of days just to make sure everything goes smooth; This is for OC 2.0.3.1;

Code: Select all

<file name="catalog/model/total/total.php" error="log">
		<operation>
			<search position="replace"><![CDATA[
				'value'      => max(0, $total),
			]]></search>
				<add trim="true"><![CDATA[
				'value'      => max(0, round($total)),
				]]></add>
		</operation>
	</file>

New member

Posts

Joined
Sun Jun 05, 2011 7:06 pm
Who is online

Users browsing this forum: No registered users and 9 guests