Post by zekin » Mon Jul 15, 2013 3:21 pm

Hi, I have been using OC for a year, most of the extensions I bought were non-vqmod, they were either written instructions eg find "such such" and ADD AFTER / REPLACE / ADD BEFORE etc, or simply a self-contained module with no core-altering needed. And since my site already modded with so many extensions, I actually prefer keeping the whole site non-vqmod. Another reason I prefer non-vqmod is that because usually I will write my own comment with the mods , so when I look at the code later, I know what I have modified.

However a lot of great mods are in vqmod, including some that I am planning to purchase.

So my question is, is there some software that will translate vqmod xml into something human readable instructions?

Thank you in advance.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by labeshops » Mon Jul 15, 2013 7:51 pm

They are readable instructions. You can install any vqmod you want without using vqmod. Just read thru the xml vqmod file - they show you which file to modify, search for x and add/replace/before/after code to add.

Running Opencart v2.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by zekin » Mon Jul 15, 2013 8:19 pm

labeshops wrote:They are readable instructions. You can install any vqmod you want without using vqmod. Just read thru the xml vqmod file - they show you which file to modify, search for x and add/replace/before/after code to add.
Thanks a lot. I get it now.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by zekin » Wed Jul 31, 2013 10:29 am

I am using vqmod now and I even tried to write my 1st simple mod.

Got to say, this is the most amazing invention. I wished I installed it earlier.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by labeshops » Wed Jul 31, 2013 8:38 pm

It does make a lot of things easier :) Glad you figured it out.

Running Opencart v2.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by ogun » Wed Jul 31, 2013 10:10 pm

Was thinking about something like this just to make it easier on my eyes.

Only just started looking at it so this initial version/proof of concept as is rough as toast, but anyway:

1. Save this as human.xsl in your vqmod/xml folder:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:template match="/">
		<html>
			<head>
				<style type="text/css">
					body {
						font-family: sans-serif;
						background:lightgray;
					}
					h1,h2,h4 {
						margin:0;
					}
					.file {
						background:white;
						border:1px lightgray solid;
						margin-bottom:0.5em;
						padding:0.5em;
					}
					.file h2 {
						padding:0.25em;
						border-bottom:1px lightgray solid;
					}
					.file div {
						border:1px lightgray solid;
						margin:0.25em 0.25em 0.5em 0;
						padding:0.5em;
					}
					ol {
						font-weight:bold;
					}
					ol li {
						font-weight:normal;
						margin-bottom:0.5em;
						border-bottom:1px black solid;
					}
					p {
						margin-bottom:0.5em;
					}
					pre {
						border:1px lightgray solid;
						padding:0.5em;
						background: black;
						color: lightgreen;
						margin:0.25em 1em 0.25em 0.25em;
						overflow:scroll;
					}
			</style>
			</head>
			<body>
				<h1><xsl:value-of select="modification/id" /></h1>
				<h4>Version: <xsl:value-of select="modification/version" /></h4>
				<h4>(VQMod required version: <xsl:value-of select="modification/vqmver" />)</h4>
				<h4>Author: <xsl:value-of select="modification/author" /></h4>

				<hr />

				<xsl:for-each select="modification/file">

					<div class="file">
						<h2>
							<xsl:if test="@path">
								<xsl:value-of select="./@path" />
								|
							</xsl:if>
							<xsl:value-of select="./@name" />
							<!-- We could add a warning/reminder here that error will be ignored if path or name contain wildcards -->
							<xsl:if test="@error">
								(on error,
								<xsl:value-of select="./@error" />
								)
							</xsl:if>
						</h2>

						<ol>
							<xsl:for-each select="./operation">
								<li>
									<xsl:if test="@info">
										<p class="info"><xsl:value-of select="./@info" /></p>
									</xsl:if>

									<xsl:if test="./ignoreif">
										<div>
											<h4>Ignore if:</h4>
											<xsl:if test="./ignoreif/@regex">
												<p class="regex">Apply this regular expression: <span><xsl:value-of select="./ignoreif/@regex" /></span></p>
											</xsl:if>
											<pre><xsl:value-of select="./ignoreif" /></pre>
										</div>
									</xsl:if>

									<div>
										<!-- If offset and/or index are set, they could be used with position to make a human-readable instruction -->
										<!-- Should also show different output depending on the value of position, e.g. top means search is ignored -->
										<h4>Search <xsl:value-of select="./search/@position" /></h4>
										<xsl:if test="./search/@offset or ./search/@index">
											(
											<xsl:if test="./search/@offset">
												Offset:
												<xsl:value-of select="./search/@offset" />
											</xsl:if>
											<xsl:if test="./search/@offset and ./search/@index">,</xsl:if>
											<xsl:if test="./search/@index">
												Index:
												<xsl:value-of select="./search/@index" />
											</xsl:if>
											)
										</xsl:if>
										<xsl:if test="./search/@regex">
											<p class="regex">Apply this regular expression: <span><xsl:value-of select="./search/@regex" /></span></p>
										</xsl:if>
										<pre><xsl:value-of select="./search" /></pre>
										<xsl:if test="./search/@trim">
											<xsl:choose>
												<xsl:when test="./search/@trim = 'true'">
													<p class="trim">Trim any white space.</p>
												</xsl:when>
												<xsl:otherwise>
													<p class="trim">Leave any white space as it is.</p>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:if>
									</div>

									<div>
										<h4>Add <xsl:if test="./add/@error">(on error, <xsl:value-of select="./add/@error" />)</xsl:if></h4>
										<pre><xsl:value-of select="./add" /></pre>
										<!-- VQMod looks for a lowercase "true" or "false" -->
										<xsl:if test="./add/@trim">
											<xsl:choose>
												<xsl:when test="./add/@trim = 'true'">
													<p class="trim">Trim any white space.</p>
												</xsl:when>
												<xsl:otherwise>
													<p class="trim">Leave any white space as it is.</p>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:if>
									</div>

								</li>
							</xsl:for-each>
						</ol>
					</div>
				</xsl:for-each>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
2. Temporarily add the following to the top of your VQMod XML file so that you can view it in a browser:

Code: Select all

<?xml-stylesheet type="text/xsl" href="human.xsl"?>
3. Open the VQMod XML file in your browser.
Last edited by ogun on Thu Aug 01, 2013 7:06 pm, edited 1 time in total.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by zekin » Wed Jul 31, 2013 10:25 pm

ogun wrote:Was thinking about something like this just to make it easier on my eyes.

Only just started looking at it so this initial version/proof of concept as is rough as toast, but anyway:

1. Save this as human.xsl in your vqmod/xml folder:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
	<style type="text/css">
		body {
			font-family: sans-serif;
		}
		h1,h4,h2 {
			margin:0;
		}
		.file {
			border:1px lightgray solid;
			margin-bottom:0.5em;
		}
		.file h2 {
			padding:0.25em;
			border-bottom:1px lightgray solid;
		}
		ol {
			font-weight:bold;
		}
		ol li {
			font-weight:normal;
			margin-bottom:0.5em;
		}
		pre {
			border:1px lightgray solid;
			padding:0.5em;
			background: black;
			color: lightgreen;
			margin:0.25em;
		}
	</style>
</head>
<body>
	<h1><xsl:value-of select="modification/id"/></h1>
	<h4>Version: <xsl:value-of select="modification/version"/></h4>
	<h4>(VQMod required version: <xsl:value-of select="modification/vqmver"/>)</h4>
	<h4>Author: <xsl:value-of select="modification/author"/></h4>
	
	<hr />

	<xsl:for-each select="modification/file">
		<div class="file">
			<h2><xsl:value-of select="./@name"/></h2>
			<ol>
				<xsl:for-each select="./operation">
					<li>
						Search <xsl:value-of select="./search/@position"/>:
						<pre>
							<xsl:value-of select="./search"/>
						</pre>
						Add:
						<pre><xsl:value-of select="./add"/></pre>
					</li>
				</xsl:for-each>
			</ol>
		</div>
	</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
2. Temporarily add the following to the top of your VQMod XML file so that you can view it in a browser:

Code: Select all

<?xml-stylesheet type="text/xsl" href="human.xsl"?>
3. Open the VQMod XML file in your browser.

WOW!!! this is awesome!

O0

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by ogun » Wed Jul 31, 2013 10:49 pm

tyvm :)

It is very rough though - i haven't looked at the file spec or anything so don't rely on it for production use, there could be big chunks of the XML not being shown, or vital attributes missing. Will post an update (probably be Friday now) after looking at the spec.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by Qphoria » Thu Aug 01, 2013 1:46 am

Hmm... The htaccess file in the vqmod folder should prevent you from viewing xml files in your browser

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by zekin » Thu Aug 01, 2013 9:46 am

Qphoria wrote:Hmm... The htaccess file in the vqmod folder should prevent you from viewing xml files in your browser
If followed ogun's method, can actually open it locally on PC with eg firefox as long as xml and xsl in the same folder.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by ogun » Thu Aug 01, 2013 7:21 pm

Sorry, I forgot to mention that the files were being opened locally in Firefox (or IE). Chrome doesn't seem to like the local URLs so it doesn't work in that one. I know the global community of Opera users is important, but I don't care what either of them think so didn't test it in that :)

It hasn't been tested in Safari either - so if anyone reads this and is happy paying too much for bad coffee or likes wearing a hat indoors, please let me know how you get on.

Have updated human.xsl in the original post so that it should pick up/display all of the elements and attributes mentioned in the vQmod wiki. It's still ugly, and it would be best to triple-check anything done based on its output, but it should work.

If folks find it useful then I'll give it another revision to test it thoroughly, make the instructions more human-readable (e.g. create a sentence based on the values of position, offset and index for a given search) and add something so that you don't need to modify the XML files.

Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am

Post by Qphoria » Fri Aug 02, 2013 8:44 pm

ogun wrote:. I know the global community of Opera users is important, but I don't care what either of them think so didn't test it in that :)
LOL poor Opera... they were the browser to beat back in the day before Mozilla came out. But they screwed themselves being a paid browser and let firefox pass them by. They have always had the fastest browser and were the pioneers of features like Speed dial and paste-n-go and duplicate tab... things we take for granted now. But too bad they waited too long to go free, and their previous web engine was fast but didn't always display things correctly (tho mainly because those sites were made to look right in IE which is just terrible).

Ah well... Chrome works good enough for me :)

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by butte » Sun Aug 11, 2013 10:26 am

(1) Any (major, competent) browser will load and execute http://localhost/[filespec] = http://127.0.0.1/[filespec] files that can be seen on-line (.html,.htm, and if php.exe is loaded also .php, etc.), IF an Apache server is actively running on the machine. Loading local MERE FILES as such, file:///[filespec] depends upon operating system and browser in combination as well as the filespecs. Various little minibrowsers may have insurmountable difficulty with simple. Out of the foregotten eras, Archean through Cambrian, b.c. (before color), we also have such leftovers as text-only browsers for gopher://[filespec].

(2) Fiddling with .xml or other "code" files in order just to set them up to see them conveniently in a browser is not as expedient as viewing them in a competent ascii editor that is moreover intended for editing CODE, such as, among others, freeware crimson editor. When any code file, .xml included, is brought up in crimson editor or similar ascii code editors, its various code elements are settably differentiated in font faces, emphases (bold, italic, etc.) and colors, with cursor-following bands if desired, moreover differently for any of several code types or languages. That is far easier on the eyes and temper than is fiddling with files that must be unfiddled in order to see them in one color in a browser, and permits expediently excising, excerpting, or condensing the same files to be saved as .txt rather than .xml, for example, for various purposes such as those of concern in the thread.

[Damn it, what is the incessantly recurrent "no post mode specified" crap?!] [And, yes, its bloody cookies are allowed.]

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by ogun » Tue Mar 03, 2015 7:51 pm

Needed to browse through a bunch of vqmods looking for a conflict, so have revisited this. It's still ugly/unpolished - and only works in the latest Firefox (that's all I needed), but now has drag-and-drop and syntax highlighting.

Usage:
1. Unzip the attached files to your "vqmod/xml" folder.
2. Open human.htm in Firefox.
3. Drag an xml file from your "vqmod/xml" folder into the green area at the top of the page.

..it should then display the vQmod as a series of instructions for a human.

Attachments


Active Member

Posts

Joined
Tue Aug 14, 2007 6:04 am
Who is online

Users browsing this forum: No registered users and 5 guests