Jump to content

Another issue with Fusion/Vector.


Nik Grey

Recommended Posts

I only just had help getting another issue with Cubecart/Fusion/Vector fixed and feel as if I am expecting too much by asking for help again this soon..

But I have spent the last hour going over the instructions that came with my 'Image Upload' tool, and following them.. guess what ? I can't get this to work either.

 

Brian worked out what was causing my last problem and I am wondering if the same issue could be stopping my tool from working.

 

This tool was built using 'Hooks' and I thought it was 'Bullet proof'.

 

Here's what Brian thought was going on before:

 

 

Here is my brief summary (wild guess) as to what the problem was:

 

The Vector skin is Fusion-based. As such, Fusion is required to be running prior to when CubeCart tells Smarty what skin to be using.

When specific Tool files were called via ajax requests, those files had CubeCart run through its controller file.

For a reason I have not yet determined, Smarty was crashing on the skin when CubeCart was running through all the things it does via the controller.

 

Thus, the Tool's file never finished executing and no data was received by the ajax caller.

 

What we did (mostly), was to 'micro-manage' CubeCart's waking-up to avoid the point where the skin is initialized.

 

 

The instructions that came with this (Bespoke) plugin are simple:

 

 

The mod includes versions for each of the built in skins if you'd like to tailor it to specific skins, if you have a custom skin, you may need to make changes to get the mod to match the rest of your site. Normally it just uses the generic file not inside a skin.

If you open up the following directory:

modulespluginsImage_Uploaderskintemplates

You'll see a list of skins, create a new folder with the same name as the skin you're using, then copy in the default product.imageupload.tpl found in the same directory.
You'll then need to change it to match your custom skin. A good place to start is to compare the sale items template with the latest products box on the regular homepage (found in skins/yourskin/templates/product.imageupload.tpl).

 

 

So, all of that was no problem - it's done.

 

Next:

 

 

A single code change is required to insert the changes onto your skin. Open whatever skins are in use in your store, go to the templates folder, and find main.php and open it up

FIND:

  {foreach from=$JS_SCRIPTS key=k item=script}
  <script type="text/javascript" src="{$STORE_URL}/{$script|replace:'':'/'}"></script>
  {/foreach}

ADD BELOW:

  {if !empty($IMAGE_UPLOAD_JS)}{$IMAGE_UPLOAD_JS}{/if}

 

 

 

Here's what the original code looks like from the un-touched Vector (main.php).

 

<!-- Plugin JavaScripts -->
        {foreach from=$JS_SCRIPTS key=k item=script}
            <script src="{$STORE_URL}/{$script}"></script>
        {/foreach}

 

I have tried this:

 

<!-- Plugin JavaScripts -->
        {foreach from=$JS_SCRIPTS key=k item=script}
  <script type="text/javascript" src="{$STORE_URL}/{$script|replace:'':'/'}"></script>
  {/foreach}
  {if !empty($IMAGE_UPLOAD_JS)}{$IMAGE_UPLOAD_JS}{/if}

 

 

But I don't know what else I can try !

 

 

 

Link to comment
Share on other sites

Please keep in mind that CubeCart has a skin template cache system (actually, it's Smarty's cache). When making changes to any skin file, you should clear the cache after each editing effort.

 

If you anticipate making many edits, consider switching off the cache in admin, Store Settings, Advanced tab.

 

You have correctly edited the main.php file.

Link to comment
Share on other sites

I did have all Caching disabled Brian, but still a good idea to drill this into everyone reading.

 

Been sitting here for a while, with Firebug - what an outstanding tool that is ! I will make a point of learning everything I can about that..

 

I think it's only right to expect some sort of support from Shopdev so I have opened up another ticket as a 'Paid' customer this time, hopefully I will get a response (holding breath).

 

My whole business is built around the two tools I am trying to get working with the skin of my choice, I am not surprised we had problems with the Lettering Tool but the Image Upload I thought would be fine as it was built with Hooks - I was just going through the 'Show Off' thread, where people are posting their new Cubecart websites (I will do that one day) and noticed somebody say 'It's a steep learning curve' - your not wrong there. 'Frustrating' is MY word of the year so-far but with great support here the job will get done and I will be able to finally open and hopefully make some money after all of this time.

 

Me and mine have been on Bread and Water for some time now :(

Link to comment
Share on other sites

Still nothing from Shopdev.

"Our target response time is 24 hours. Whilst we are often happy to provide advice, we cannot offer techincal support for third party modifications or plugins. We recommend that you seek support from the modification or plugin developer where you have any issues with such."

 

..and maybe that's the reason :(

 

As this is a Plugin, and written specifically for CC5.2.5 - I am hoping it will be possible to fix it in the same way the other tool was revived.

 

Last night I worked out how much I had spent on tools, licenses etc and it's frightening - one thing is for sure, I have come too far to give up now.

Link to comment
Share on other sites

I'd go as far as to say that it's not unreasonable to expect a skin to not rewrite the javascript calls so that it, and it exclusively has access to jquery... that I think it what it seems to be doing anyhow.. not seen the particular script before, but essentially it seems to be making jquery and all the files the skin uses load only when the document has loaded, by storing them in an object which has a ready function of its own, presumably for more optimal page loads.

 

Loses out on a fair bit of flexibility doing that though, and sortof breaks our one completely. In an attempt to make the code changes as minimal as possible I went for a purely plugin based route where the js was loaded via the skin

 

Have a try of this Nik:

On the vector skin, there's a file in /js/ called application.js, at the bottom there's this bit:

 

{jquery: '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'},

 

You can try commenting that out:

 

// {jquery: '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'},

 

Then just grab the same jquery call from one of the standard skin files (main.php), and try just bunging it in the vector header?

 

I'm not 100% if the fix will work unfortunately.. it's plausible that whatever is going on in the header object, it might try and reference the js by the jquery parameter it's sending with the filename, in which case it'll just break everything no doubt. Won't hurt to try though, you can always set it back how it was

Link to comment
Share on other sites

With the help of Brian this issue has been resolved - now all of my tools are working.

 

It took the addition of One single word in the code to rectify the problem I had but before anything could be done my Plugin had to be examined, went through with a Fine Toothed Comb.

 

Brian did it again - I have so much to be thankful to him for.

Link to comment
Share on other sites

The following is my analysis of why the 3rd-Party Uploader mod was not working with the Vector skin:

 

CubeCart has six standard skins (and a mobile skin). Each skin uses the same class names and id names for the div's, etc. For example, every stock skin has this:

{if is_array($OPTIONS)}
  <div class="options">
  {foreach from=$OPTIONS item=option}
    {if $option.type == '0'}
    <div>
      <label for="option_{$option.option_id} class="return"> ... </label>

The Vector skin has this:

<div class="product-options">
{if isset($OPTIONS) && is_array($OPTIONS)}
  {foreach from=$OPTIONS item=option}
  <div class="control-group">
  <label for="product-option-{$option.option_id}" class="control-label"></label>
  <div class="controls">
  {if $option.type == '0'}

The HTML statements are organized a little differently, and generally that should not be a problem.

The problem comes into play when a mod's javascript wants to identify an HTML node (such as a particular <div>) by referencing its ID or its CLASS. If at all possible, the mod author should try to have the javascript reference a node's ID if that node is the ONE and ONLY thing the javascript wants to affect. But in the Uploader code, the javascript wants to affect ALL of the nodes that are of a certain CLASS.

 

(Actually, that is not the case. CubeCart skin code sets the CLASS to "options" of the <div>. If this is the one and only group of options being displayed, then setting the <div> to have an ID of "options" would have been the preferred coding.)

It is important that the ID and CLASS names remain consistent across all skins.

Vector does not do this.

Here is the relavent Uploader javascript:
jQuery("div.options label").each(function(){

The "div.options label" is telling javascript to find all <label> tags that are descendents of every <div class="options"> nodes. Stock skins have this, Vector does not.

So, in Vector, edit the template file content.product.php, near line 117, and edit this statement:

Was:
<div class="product-options">
Now:
<div class="product-options options">

This adds the class "options" (you can have more than one name in the class attribute) to the <div>.

The javascript now finds what it is looking for in Vector.
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...