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

altered carts OnSale mod for php 7+
 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #1  
Old 04-25-2019, 10:27 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 734
 

Default altered carts OnSale mod for php 7+

I bought the unencrypted files from AlteredCart for the OnSale mod when Bill was closing up shop, did anyone else do that so they could update the files for php7+? I don't have enough coding knowledge to know what I'm doing and was looking to see if anyone has it working already.
Thanks.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #2  
Old 04-25-2019, 12:18 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,608
 

Default Re: altered carts OnSale mod for php 7+

I use AC's Cash Rewards and had an issue with PHP 7.x because AC Cash Rewards uses mysql_real_escape_string() which is not supported in PHP 7.x.

Check your log files to see if you have a PHP error for mysql_real_escape_string()

If yes maybe the following will help.

Steve pointed me to X-Cart's func_addslashes($html_escape) so I added the following to func.core.php

After:
Code:
function func_get_internal_banners($type) { global $sql_tbl; if (empty($type)) { return; } $return = func_query("SELECT * FROM $sql_tbl[internal_banners] WHERE type='$type'"); return $return; }

Add:
Code:
function mysql_real_escape_string($html_escape) { return func_addslashes($html_escape); }
__________________
X-Cart GoldPlus v4.7.11 | PHP 7.2.22
  • XCARTMODS.CO.UK | reBOOT Template |
  • Smack Digital | CDSEO Pro 2.0 + Custom Replacements | Category SEO Map |
  • Total Server Solutions Hosting | Linux | PHP v7.2 | MySQL v5.6.40 |
Reply With Quote
  #3  
Old 04-25-2019, 12:50 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 734
 

Default Re: altered carts OnSale mod for php 7+

thanks for the reply elmirage but i didn't even get that far yet, I was just wondering if anyone one had done it successfully yet.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote

The following user thanks keystone for this useful post:
elmirage001 (04-25-2019)
  #4  
Old 04-25-2019, 08:26 PM
 
Thomasb134 Thomasb134 is online now
 

X-Adept
  
Join Date: Apr 2007
Location: USA
Posts: 760
 

Default Re: altered carts OnSale mod for php 7+

I can't offer any direct advice with porting the AC OnSale module. But I know what you are up against. I'm nearly done with doing that to Bill's Checkout One (one page checkout) module. It's been a horrible experience but I think I've finally beaten it.

You can get a feel for some issues by testing the module's php files using these online PH7 compatibility tools:
https://phpcodechecker.com/
https://www.piliapp.com/php-syntax-check/


As mentioned in the previous post, you'll need to recreate the missing mysql_real_escape_string() function. And I suspect there will be some instances of the deleted mysql_query() function (removed in PHP7). It can be replaced with db_query().

Be sure to work from a development store because it may take awhile to sort through all the problems that come up.

No doubt there will be more to it than these things. But if you post about the issues that pop up then maybe the community can walk you through it.

BTW, I'm using XC's Onsale Module (X-HotProducts) and it is working in my 4.4.5 store with PH7, no patches.
__________________
Thomas / USA
XCart V4.4.5 Gold
XCart Mobile V1.4.12
XCart X-PDF
XCart X-HotProducts
AlteredCart Checkout One (One Page Checkout)
BCSE Back In Stock
CFL Holiday Message
CFL System Message
Smack Digital (WebsiteCM) Remember Anon Carts
xcartmods Testimonials
Unix, PHP 7.0 (patched 5.4). Currently patching PHP 7.1
MySQL 5.6
Reply With Quote

The following 2 users thank Thomasb134 for this useful post:
Dougrun (05-31-2019), elmirage001 (04-25-2019)
  #5  
Old 04-25-2019, 09:34 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,608
 

Default Re: altered carts OnSale mod for php 7+

I second Thomas's recommendation of X-Cart's Onsale module. I've been using it for a few years now. Our sales change a lot so I'm putting things on sale and taking others off sale all the time. I got tired of the labor intensive process very quickly so I came up with the following.

Final version is the last post.

https://forum.x-cart.com/showthread.php?t=75341

Paul
__________________
X-Cart GoldPlus v4.7.11 | PHP 7.2.22
  • XCARTMODS.CO.UK | reBOOT Template |
  • Smack Digital | CDSEO Pro 2.0 + Custom Replacements | Category SEO Map |
  • Total Server Solutions Hosting | Linux | PHP v7.2 | MySQL v5.6.40 |
Reply With Quote
  #6  
Old 05-24-2019, 01:33 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 734
 

Default Re: altered carts OnSale mod for php 7+

The problems I have with x-carts Onsale module are that you can't do nearly the types of sales such as buy 2 get one free, spend x get x discount on the order, etc. I guess it works ok if you just want to do straight discounts on individual products but AC onsale mod spoiled me I think.

Thomas, thanks for the links to the tools, I'll give them a shot. I added the code to the func.core.php file as a start so I'll see how it goes.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #7  
Old 05-24-2019, 02:06 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,608
 

Default Re: altered carts OnSale mod for php 7+

jQuery was updated in 4.7.11 and I had to update a section of Bill's code in his Cash Rewards. You may need to check his code for any thing deprecated.

For example Bill used .live but it is now deprecated and I had to change as shown below.
From:
Code:
// Cash Rewards :: www.alteredcart.com // $('.unsetCashRewards').live('click', this._unsetRewards); $('.applyRewardButton').live('click', this._applyRewards); // Cash Rewards :: www.alteredcart.com //
To:
Code:
// Cash Rewards :: www.alteredcart.com // $(document).on('click','.unsetCashRewards',this._unsetRewards); $(document).on('click','.applyRewardButton',this._applyRewards); // Cash Rewards :: www.alteredcart.com //

I didn't know initially that .live was the issue. I found by a process of elimination (the long and painful method)

This page showed me how to fix the issue. http://api.jquery.com/live/

Hopefully you won't have any jQuery issues to worry about. Good luck!

Paul
__________________
X-Cart GoldPlus v4.7.11 | PHP 7.2.22
  • XCARTMODS.CO.UK | reBOOT Template |
  • Smack Digital | CDSEO Pro 2.0 + Custom Replacements | Category SEO Map |
  • Total Server Solutions Hosting | Linux | PHP v7.2 | MySQL v5.6.40 |
Reply With Quote
  #8  
Old 06-03-2019, 11:07 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 734
 

Default Re: altered carts OnSale mod for php 7+

Using the recommended PHP Code Checker I have this issue...

session_register is depreciated

I have this code
Code:
// Page Control // x_session_register('page_control'); if (!$page_control && empty($change)){ $page_control = 'overview'; } if (!empty($change)){ $page_control = $change; }

I see that the recommended fix is
Two things that came to my mind:

Quote:
Using global variables is not good anyway, find a way to avoid them.
You can still set variables with $_SESSION['var'] = "value".
Can someone show me how to fix this one? I'm not sure how, once I see and example I should be able to fix the rest of the instances on my own (hopefully)
Thanks.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #9  
Old 06-03-2019, 11:46 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,615
 

Default Re: altered carts OnSale mod for php 7+

x_session_register is XC function not PHP function. It is declared in include/sessions.php I believe. There is nothing to fix.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #10  
Old 06-03-2019, 12:35 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 734
 

Default Re: altered carts OnSale mod for php 7+

ah, ok. Thanks.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not 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 01:52 PM.

   

 
X-Cart forums © 2001-2018