Jump to content

Code update help


Recommended Posts

In the templates/content.product.php file, at line 216 you see:

{if isset($PRODUCT.discounts)}
            <p>(<a href="#quantity_discounts">{$LANG.catalogue.bulk_discount}</a>)</p>
            {/if}
            {if ($CTRL_ALLOW_PURCHASE) && (!$CATALOGUE_MODE)}
            <div class="row collapse">
               {if $PRODUCT.available <= 0}
               <div class="small-12 columns">
                  <input type="submit" value="{$LANG.common.unavailable}" class="button small disabled expand marg-top" disabled>
               </div>
               {else}

I have custom code here...

 

Then there is:

<div class="medium-2 columns show-for-medium-up">
                  <input type="text" name="quantity" value="1" class="quantity required text-center">
                  <input type="hidden" name="add" value="{$PRODUCT.product_id}">
                  <input type="hidden" name="leadtime_overlay" value="1">
               </div>
               <div  class="small-12 medium-10 columns">
                  <button type="submit" value="{$LANG.catalogue.add_to_basket}" class="button postfix">{$LANG.catalogue.add_to_basket}</button>
               </div>
               {/if}
            </div>

 

Can you help me figure out where to put my custom code in 6.2.0? 

 

Link to comment
Share on other sites

I believe the core CC620 code is fine. I, too, have a blank screen because of a problem with the Foundation skin that ships with CC620.

As far as the Foundation skin is concerned, other than a few tweaks here and there, the significant difference is minification.

There are two parts.

Part1: Collecting all the CSS files and concatenating them into one big file, writing that file to the /cache/ folder, then putting HTML in the template that makes that cached file the page's CSS resource link. Collecting all the JS files, and doing the same.

Part2: Having Smarty send its rendered output through a new Smarty output filter. This filter wrings all the whitespace out of the HTML, resulting in (mostly) one single line of HTML code.

I have eliminated Part2 causing my problem.

I have bypassed the code changes made in Part1.

Now, I get the page, but the Foundation javascript fails to start.

What is mostly different about my server environment is I run Windows with PHP 5.4.44. But I have not yet proven this is the incompatible factor.

Oddly, I have another Windows server running PHP 7.1, but it has a fresh CC620Beta1 installed. It works fine.

Link to comment
Share on other sites

30 minutes ago, bsmither said:

I believe the core CC620 code is fine. I, too, have a blank screen because of a problem with the Foundation skin that ships with CC620.

As far as the Foundation skin is concerned, other than a few tweaks here and there, the significant difference is minification.

There are two parts.

Part1: Collecting all the CSS files and concatenating them into one big file, writing that file to the /cache/ folder, then putting HTML in the template that makes that cached file the page's CSS resource link. Collecting all the JS files, and doing the same.

Part2: Having Smarty send its rendered output through a new Smarty output filter. This filter wrings all the whitespace out of the HTML, resulting in (mostly) one single line of HTML code.

I have eliminated Part2 causing my problem.

I have bypassed the code changes made in Part1.

Now, I get the page, but the Foundation javascript fails to start.

What is mostly different about my server environment is I run Windows with PHP 5.4.44. But I have not yet proven this is the incompatible factor.

Oddly, I have another Windows server running PHP 7.1, but it has a fresh CC620Beta1 installed. It works fine.

So I should have waited longer then :) I just spent a couple hours comparing code to make sure I moved my custom stuff over. 

Link to comment
Share on other sites

Invalid argument supplied for foreach() in ****/classes/catalogue.class.php on line 258:   foreach ($products as $product) {

Invalid argument supplied for foreach() in ****/modules/plugins/extended_leadtimes/hooks/class.catalogue.category_product_list_return.php on line 15:  foreach($productList as $key => $val){

 

Link to comment
Share on other sites

Nothing interesting in that log.

Let's see if some output gets sent out by bypassing one of the new things the CC620 skin is doing.

In the CC620 Foundation template element.js_foot.php:

Replace the entire contents with:

            <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.rating.min.js" type="text/javascript"></script>
            <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.validate.js" type="text/javascript"></script>
            <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.cookie.js" type="text/javascript"></script>
            <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.bxslider.js" type="text/javascript"></script>
            <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.chosen.js" type="text/javascript"></script>
            {foreach from=$BODY_JS item=js}{$js}{/foreach}
            {foreach from=$JS_SCRIPTS key=k item=script}
            <script src="{$STORE_URL}/{$script|replace:'\\':'/'}" type="text/javascript"></script>
            {/foreach}
            <script>{literal}$(document).foundation({equalizer:{equalize_on_stack:true}});$('.bxslider').bxSlider({auto:true,captions:true});$('.chzn-select').chosen({width:"100%",search_contains:true});{/literal}</script>
{*
{assign var=js_foot value=[ 'skins/{$SKIN_FOLDER}/js/vendor/jquery.rating.min.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.validate.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.cookie.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.bxslider.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.chosen.js']}
{foreach from=$BODY_JS item=js}
    {$js_foot[] = $js}
{/foreach}
{foreach from=$JS_SCRIPTS key=k item=script}
    {$js_foot[] = $script}
{/foreach}
{combine input=$js_foot output='cache/js_foot.{$SKIN_FOLDER}.js' age='604800' debug=false}
*}

In element.css.php:

Replace the entire contents with:

      <link href="//fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type='text/css'>
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/normalize.css" rel="stylesheet">
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/foundation.css" rel="stylesheet">
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.css" rel="stylesheet">
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.common.css" rel="stylesheet">
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.helpers.css" rel="stylesheet">
      {if !empty($SKIN_SUBSET)}
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.{$SKIN_SUBSET}.css" rel="stylesheet">
      {/if}
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/jquery.bxslider.css" rel="stylesheet">
      <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/jquery.chosen.css" rel="stylesheet">
      {foreach from=$CSS key=css_keys item=css_files}
      <link href="{$STORE_URL}/{$css_files}" rel="stylesheet" type="text/css" media="screen">
      {/foreach}
{*
{assign var=css_input value=[   'skins/{$SKIN_FOLDER}/css/normalize.css',
                                'skins/{$SKIN_FOLDER}/css/foundation.css',
                                'skins/{$SKIN_FOLDER}/css/cubecart.css',
                                'skins/{$SKIN_FOLDER}/css/cubecart.common.css',
                                'skins/{$SKIN_FOLDER}/css/cubecart.helpers.css',
                                'skins/{$SKIN_FOLDER}/css/jquery.bxslider.css',
                                'skins/{$SKIN_FOLDER}/css/jquery.chosen.css']}
{foreach from=$CSS key=css_keys item=css_files}
    {$css_input[] = $css_files}
{/foreach}
{if !empty($SKIN_SUBSET)}
    {$css_input[] = 'skins/{$SKIN_FOLDER}/css/cubecart.{$SKIN_SUBSET}.css'}
{/if}
{combine input=$css_input output='cache/css.{$SKIN_FOLDER}.css' age='604800' debug=false}
*}

In element.js_head.php:

Replace the entire contents with:

      <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/modernizr.js"></script>
      <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.js"></script>
      {foreach from=$HEAD_JS item=js}{$js}{/foreach}
{*
{assign var=js_head value=[ 'skins/{$SKIN_FOLDER}/js/vendor/modernizr.js',
                            'skins/{$SKIN_FOLDER}/js/vendor/jquery.js']}
{foreach from=$HEAD_JS item=js}
    {$js_head[] = $js}
{/foreach}
{combine input=$js_head output='cache/js_head.{$SKIN_FOLDER}.js' age='604800' debug=false}
*}

In admin, clear the cache.

 

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...