Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Simple CMS module and custom page code

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #21  
Old 01-28-2016, 07:29 AM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: Simple CMS module and custom page code

anything ?

(I find I am also particularly distressed by the fact this board practices revisionist history and has deleted the numerous posts by me on a daily basis while looking for responses from the community, in order to keep my post from falling into obscurity)

I find that I much prefer the news:// format, as is continuing to be used by gmane.org, which provides a bidirectional gateway to various mailing lists, using a newsreader format. lists are much easier to follow, fewer posts get lost in obscurity on 'page 2+', it's more compact to review post titles with, etc. The majority of Web Forum formats are, by their very nature, far less efficient
__________________
--
Scott Godin
Reply With Quote
  #22  
Old 02-03-2016, 07:15 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Simple CMS module and custom page code

If you want a definite answer you should do this under your QT Helpdesk account.
The forum is free resource where ppl like me contribute their own time to post/answer. But nothing in here is guaranteed for quality, time, etc.

In many cases for many tasks you can hire a professional outside QT but in this case for the question on how XC5 works with js/css aggregation you should ask QT - they are the developer of XC5 and they should know the answer. This is way too much in the core of the system for anyone else to have indefinite answer.

And it is possible that XC5 just works in this way or this is a bug or not coded or....
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #23  
Old 02-04-2016, 07:20 AM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: Simple CMS module and custom page code

I was sort of thinking to not jump the gun here, but instead look for correspondence with qualiteam on this who can

A> confirm it is a bug and that i should report it,
B> Confirm it is a bug that has already been reported (with link to bug),
C> confirm a fix is already in the works for known bug and it should be out in the next release, or
D> I'm doing it wrong, it doesn't work that way, we aren't going to fix this, deal with it, etc

I had previously been doing ALL my correspondence with tech support directly, and switched to the forums for certain things, after discussion with the team, to help spread the load around a little better.
__________________
--
Scott Godin
Reply With Quote
  #24  
Old 02-09-2016, 09:17 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Simple CMS module and custom page code

Quote:
If you add a resource with the "url" key, not "file", X-Cart 5 won't aggregate the file. So, this should work as you expect.

I've just tried this on my local X-Cart 5 installation and it works there exactly as I said in my previous post - it does not aggregate external scripts.
Here is what I see in the page source code:
Code:
... <script type="text/javascript" src="http://xcart/xc5/src/var/resources/js/343a30b273e2ec6c0a3f7e93f23c86c58e081f64b4faa9d3b88d21de2580196f.js?1455030625"></script> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/jquery.nanogallery.min.js?1455030625"></script> <script type="text/javascript" src="http://xcart/xc5/src/var/resources/js/89ebbd66d82942e4e11f9f6c8f10f3caa73809350359d5d0210ff70502716007.js?1455030625"></script> ...

The code was:
PHP Code:
public function getJSFiles()
    {
        
$files parent::getJSFiles();

            
$files array_merge(
                
$files,
                array(
                    array(
                        
'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/jquery.nanogallery.min.js",
                        
'no_minify' => true
                    
),
                )
            );
 
        return 
$files;
    } 
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions

Last edited by qualiteam : 02-09-2016 at 09:20 PM.
Reply With Quote
  #25  
Old 02-10-2016, 03:19 AM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: Simple CMS module and custom page code

What version of x-cart are you running? We are on 5.2.10 currently because I'm still awaiting correspondence about an import/export bug in our current install that is holding up our desire to upgrade the devel server.

The code I have reads as follows, and is stored at classes/XLite/Module/MHG/TemplateMods/View/CustomerPage.php:

Code:
<?php // vim: set ts=4 sw=4 sts=4 et ft=php.html: namespace XLite\Module\MHG\TemplateMods\View; class CustomerPage extends \XLite\Module\CDev\SimpleCMS\View\CustomerPage implements \XLite\Base\IDecorator { public function getCSSFiles() { $files = parent::getCSSFiles(); if ( $this->isGalleryPage() ) { $files = array_merge( parent::getCSSFiles(), array( array( 'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/css/nanogallery.min.css", 'media' => 'screen', 'no_minify' => true, ), array( 'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/css/themes/light/nanogallery_light.min.css", 'media' => 'screen', 'no_minify' => true, ) ) ); } return $files; } public function getJSFiles() { $files = parent::getJSFiles(); if ( $this->isGalleryPage() ) { $files = array_merge( parent::getJSFiles(), array( array( 'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/jquery.nanogallery.min.js", 'no_minify' => true ), array( 'file' => 'modules/MHG/TemplateMods/nanogallery_local.js' ) ) ); } return $files; } protected function isGalleryPage() { // Use the getPage() method of the controller class to get the current page object $currentName = $this->getPage()->getName(); return "Photo Gallery" === $currentName; } }

If I disable aggregation, the external files load along with the rest and the gallery works.
If I enable aggregation, the external files get dropped on the floor, never get loaded in the page content as external separate urls from the aggregated css and js files and the gallery stops working.
__________________
--
Scott Godin
Reply With Quote
  #26  
Old 02-10-2016, 08:32 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Simple CMS module and custom page code

Hello Scott,

I'm using the most recent 5.2.12 version. Try to install a fresh X-Cart 5.2.12 and test your custom module there.

Also, try to remove the isGalleryPage() check from getJSFiles() and make the external script loaded on every page. If this helps, the cause may be some kind of a page cache.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #27  
Old 02-11-2016, 07:55 AM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: Simple CMS module and custom page code

Quote:
Originally Posted by qualiteam
Hello Scott,

I'm using the most recent 5.2.12 version. Try to install a fresh X-Cart 5.2.12 and test your custom module there.

am awaiting word on another bug report to tech support before I make the update

Quote:
Also, try to remove the isGalleryPage() check from getJSFiles() and make the external script loaded on every page. If this helps, the cause may be some kind of a page cache.

Nope, that didn't work either. Hopefully the 5.2.12 update will help.
__________________
--
Scott Godin
Reply With Quote
  #28  
Old 02-11-2016, 08:51 AM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: Simple CMS module and custom page code

It looks like the 5.2.12 update was the fix for this.. I don't know why it took so long to find this information out -- wouldn't it have been simpler to just say "oh, this was fixed in 5.2.12, just update when it is released" weeks ago?

argh. Such knowledge would have saved us a lot of frustration on this end, I can assure you.
__________________
--
Scott Godin
Reply With Quote
  #29  
Old 02-16-2016, 08:23 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Simple CMS module and custom page code

I would definitely told you that if I had known it.
But I thought it may be the cause. That's why I advised you to test your code on a "fresh" installation of 5.2.12 (not upgrade your existing site!).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
Scott Godin (02-18-2016)
  #30  
Old 05-08-2019, 04:58 AM
 
sales@webosusa.com sales@webosusa.com is offline
 

Senior Member
  
Join Date: Nov 2007
Location: Australia
Posts: 118
 

Default Re: Simple CMS module and custom page code

This will sove your issue...
https://market.x-cart.com/addons/custom-header-assets.html
__________________
Pedro
digitalnotions.i2u.shop
shop.modestclassy.com.au4.1.9 X-Cart
X-Cart
Business 5.3.6.0
Multi-vendor 5.3.6.0


Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:57 AM.

   

 
X-Cart forums © 2001-2020