Jump to content
Latest News: (loading..)

Recommended Posts

How can that be? It is a sprint call and the variables are used in the order given. It would make the function useless if the order didn't matter. Please explain what I am missing.

Share this post


Link to post
Share on other sites
Posted (edited)
10 minutes ago, Jack_mcs said:

How can that be? It is a sprint call and the variables are used in the order given. It would make the function useless if the order didn't matter. Please explain what I am missing.

Variables can be given in any order, and then used in any order...

First See:
https://github.com/gburton/Responsive-osCommerce/blob/master/includes/modules/content/product_info/templates/tpl_cm_pi_price.php#L3

  • sprintf(MODULE_CONTENT_PI_PRICE_DISPLAY_SPECIAL, $specials_price, $products_price)
  • variable 1 = new [special] price
  • variable 2 = old [usual] price

Then See:
https://github.com/gburton/Responsive-osCommerce/blob/master/includes/languages/english/modules/content/product_info/cm_pi_price.php#L16

  • I first use #2 (old price) in the <del>
  • I then use #1 (new price) to show the cost

Notice the difference between using %s (which is what you are thinking, I think) and use of (eg) %2$s
In this way, you can do this:
 

define('BLAH_BLAH', '%1$s had a little %2$s, its fleece was white as snow and everywhere that %1$s went the %2$s was sure to go...');

and

echo sprintf(BLAH_BLAH, 'Mary', 'Lamb');

That's a dumb example, but shows the concept.

Edited by burt

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

I'm not sure we are talking about the same thing or maybe I just don't understand your reply. Given this command

sprintf(MODULE_CONTENT_PI_PRICE_DISPLAY_SPECIAL, $VAR_1, $VAR_2) 

are you saying the order of the two variables don't matter?

Share this post


Link to post
Share on other sites
2 minutes ago, Jack_mcs said:

I'm not sure we are talking about the same thing or maybe I just don't understand your reply. Given this command


sprintf(MODULE_CONTENT_PI_PRICE_DISPLAY_SPECIAL, $VAR_1, $VAR_2) 

are you saying the order of the two variables don't matter?

That is exactly what I am saying, so long as you also take into account the placement of variables at the other end (language file).  See Mary Lamb example.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites
Just now, burt said:

That is exactly what I am saying, so long as you also take into account the placement of variables at the other end (language file).  See Mary Lamb example.

Imagine a scenario like this;  "This Review was written by John on 01/12/2018.  John gave it 5 stars out of 5."

I now give you two ways:

define('REVIEW_TEXT', 'This Review was written by %1$s on 01/12/2018.  %1$s gave it %2$s stars out of 5.');

echo sprintf(REVIEW_TEXT, 'John', '5');

OR

define('REVIEW_TEXT', 'This Review was written by %s on 01/12/2018.  %s gave it %s stars out of 5.');

echo sprintf(REVIEW_TEXT, 'John', 'John', '5');

 

OK, both do the same thing.  Now take the scenario where shopowner wants to say this:   "This Product gets 5 stars from John!"

Easier to do this:

define('REVIEW_TEXT', 'This Product gets 2$s stars from %1$s.');

No need to even look at the main module file or the template file.  

In the way you understand (just using %s), an error would probably occur somewhere.  At the very least it gets super complicated staying in a linear outlook...


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites
18 minutes ago, burt said:

That is exactly what I am saying, so long as you also take into account the placement of variables at the other end (language file).

OK. I see what you are saying. However, the argument swapping is not working for some sites. It obviously works for some since someone posted that previously but I've had two sites where it failed. Don't know why. To be honest, I didn't look at the language file so I didn't know argument swapping was being used. It seems unnecessary for a dedicated definition like this but it is what it is.

Share this post


Link to post
Share on other sites

Am i to understand that i do not need to make that change and its not really a bug then?

If i leave everything as is will be good?

Share this post


Link to post
Share on other sites
11 minutes ago, CGhoST said:

Am i to understand that i do not need to make that change and its not really a bug then?

If i leave everything as is will be good?

I -believe- so.  Use Core Code as it stands and look at a product that has a special price, it should be something like;

$99.99 $49.99

In other words, old price with a strikethru, special price in red.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites
1 hour ago, CGhoST said:

Am i to understand that i do not need to make that change and its not really a bug then?

If i leave everything as is will be good?

Yes, there's no bug unless you introduce one by making the suggested change :tongue:


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/osCommerce-234-bootstrap/archive/master.zip

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
1 hour ago, CGhoST said:

Am i to understand that i do not need to make that change and its not really a bug then?

Put an item on special and then go to that page. If the order of the prices are correct, you're all set. If not, you need to make the change.

Share this post


Link to post
Share on other sites
2 minutes ago, Jack_mcs said:

Put an item on special and then go to that page. If the order of the prices are correct, you're all set. If not, you need to make the change.

Even if not correct, your change is still not needed.  If not correct, they go and change the language file.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

LOL @BrockleyJohn

It was working fine before. I thought it was a bug so i changed it and noticed the opposite of what should be happening. Now all good again :-)

Thank You Everyone

Share this post


Link to post
Share on other sites
Posted (edited)

It would be more effective if ONLY report bugs based on the default install with 0 addons.
When use an ad-don, post ANY problem you have with it on THE CORRESPONDING addon topic.
Else this topic will not be anymore to report problems related to the frozen repository.

My guts telling me right now to delete this topic as it starts to get out of control to it's initial topic.
And where the initial topic starter lacks offering also solutions to any of the reported bugs.
No offense for what the topic starter tried.
But we all know that if there is a bug it must be reported to the repository that is offering the repository, what is in this case on github and NOT HERE.
As it is to hard to get fixes implemented by just talking here.

Edited by wHiTeHaT

Share this post


Link to post
Share on other sites

Bug in advanced_search_result.php - the data-in-stock attribute doesn't get populated in the product listing. This isn't going to matter unless you want to install an addon that uses it, eg. to disable buy buttons on out of stock items. If you do that, you'll find that they're all disabled!

change line 179 to

  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special ";

ie. add

p.products_quantity as in_stock


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/osCommerce-234-bootstrap/archive/master.zip

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
Posted (edited)

It seems there is no output for categories images in the index nested and index products modules.

There is in cm_in_title.php:

      $category_name  = $OSCOM_category->getData($current_category_id, 'name');
      $category_image = $OSCOM_category->getData($current_category_id, 'image');

But $category_image is unused in tpl_in_title.php:

<div class="col-sm-<?php echo $content_width; ?> title cm-in-title">
  <div class="page-header">
    <h1 class="h3"><?php echo sprintf(MODULE_CONTENT_IN_TITLE_PUBLIC_TITLE, $category_name); ?></h1>
  </div>
</div>

Same in cm_ip_title.php and tpl_cm_ip_title.php

 

Best fix would be to add a separate module for the image.

Here for now the index_products module:

 

category_image_module.zip

Edited by raiwa

Share this post


Link to post
Share on other sites
20 hours ago, raiwa said:

It seems there is no output for categories images in the index nested and index products modules.

This isn't a bug persé.  In normal 2.3.4 the only place category images are used is in index_nested, eg;

https://demo.oscommerce.com/index.php?cPath=3

If you click into one of these sub categories, you won't see the image;

https://demo.oscommerce.com/index.php?cPath=3_10

I placed the code in the "title" module to at least give shopowners the capability to eg;

cat_im.jpg.fe84ef4967ccba88768da4c36c16c2d8.jpg

by simply adding in a tep_image call to the relevant template.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

Yeah, maybe good, maybe not.  Maybe it might confuse shopowners as it does not exist in 234.  

Your previous post shows the index_nested subcategory layout.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

This is the reason I kinda gave up on your bug reports, you won't let things go @raiwa :)


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

Has anyone noticed the Banner is not showing in the Footer. There is a default banner in "Banner Manager" but i dont see it anywhere.

Share this post


Link to post
Share on other sites

Previous versions of oscommerce had code included that would display banners in a certain group automatically. That code has been removed and to show a banner now requires a module, or some additional code if one prefers, in order to display. 

Share this post


Link to post
Share on other sites

Not sure if this is a bug or if I am missing something. I just found  that my shop does not send out the bank transfer data  (like the IBAN etc.) in the confirmation email anymore, in case when 'money order' is the chosen payment option.

The commit from May 3  commented out a line in moneyorder.php which made it stop working here:

- $this->email_footer = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;

+ //$this->email_footer = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;

When I remove the two // it works again. What am I missing here, should there be any new module instead that sends out this data and which is not setup correctly yet? And why is the line commented out and not simply removed when not needed anymore?

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

The blame view of the file shows the change being related to an undefined constant warning. My guess is that the line is just commented so it's easy to put back if it turned out that it's needed in some circumstances, like yours!

I don't think that change to this module was correct, actually; it needed this line moving inside the test


      if ( defined('MODULE_PAYMENT_MONEYORDER_STATUS') ) {

but I predict that this module still throws an undefined constant warning (both now and with the line moved instead of commented) because MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION also refers to the same constant that is not defined unless the module is installed. The easiest fix for that is probably a change to the language file to test if MODULE_PAYMENT_MONEYORDER_PAYTO is defined.

There are loads of payment modules that had not been designed with any concern over the use of undefined constants, so were throwing warnings and to review, code and test each one in detail would not have been worthwhile. Hence the approach of commenting the line so it's easy to deal with any unintended consequences.

Edited by BrockleyJohn
too many actuallys

For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/osCommerce-234-bootstrap/archive/master.zip

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Ha ha! The fix I just described to the language file was put in on 8 May.

It looks like Gary just forgot to uncomment the line you're missing.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/osCommerce-234-bootstrap/archive/master.zip

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
On 07/06/2018 at 12:57 PM, 241 said:

I made this available via the configuration menu in admin

admin/includes/application_top.php
Find:


// Define how do we update currency exchange rates
// Possible values are 'oanda' 'xe' 'fixer' or ''
// fixer is the lastest added, more details at http://fixer.io
  define('CURRENCY_SERVER_PRIMARY', 'fixer');
  define('CURRENCY_SERVER_BACKUP', '');

Change to:


// Define how do we update currency exchange rates
// Possible values are 'oanda' 'xe' 'fixer' or ''
// fixer is the lastest added, more details at http://fixer.io
  define('CURRENCY_SERVER_PRIMARY', PRIMARY_CURRENCY_SERVER);
  define('CURRENCY_SERVER_BACKUP', BACKUP_CURRENCY_SERVER);

admin/includes/functions/localization.php
Find:


    $ch = curl_init('http://api.fixer.io/latest?base=' . $from . '&symbols=' . $to);

Change to:


    $ch = curl_init('http://data.fixer.io/api/latest?access_key=' . FIXER_ACCESS_KEY . '&base=' . $from . '&symbols=' . $to);

Database: (You can change the sort_order numbers if needs be)


INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES
('', 'Backup Currency Converter', 'BACKUP_CURRENCY_SERVER', 'xe', 'Backup currency converter different from Primary.<br>Fixer requires sign up for access key.', 1, 30, '2018-06-07 12:23:02', '0000-00-00 00:00:00', NULL, 'tep_cfg_select_option(array(\'oanda\', \'xe\', \'fixer\'),'),
('', 'Primary Currency Converter', 'PRIMARY_CURRENCY_SERVER', 'oanda', 'Primary currency converter.<br>Fixer requires sign up for access key.', 1, 29, '2018-06-07 12:22:54', '0000-00-00 00:00:00', NULL, 'tep_cfg_select_option(array(\'oanda\', \'xe\', \'fixer\'),'),
('', 'Fixer.io access key', 'FIXER_ACCESS_KEY', '', 'Fixer.io currency converter access key', 1, 28, NULL, '0000-00-00 00:00:00', NULL, NULL);

 

Just an update to instructions need to move the define section in admin/includes/application_top.php to below the configuration.

// set application wide parameters
  $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
  while ($configuration = tep_db_fetch_array($configuration_query)) {
    define($configuration['cfgKey'], $configuration['cfgValue']);
  }

admin/includes/functions/localization.php
Find:

    $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);

Change to:

    $page = file('https://www.xe.com/currencyconverter/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);

 


No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P


Support The Project
Documentation/Knowledgebase/Discussions
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×