View Single Post
  #9  
Old 02-28-2019, 06:22 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,039
 

Default Re: PHP 5.6 and 7.0 Discontinued: How It Affects Your X-Cart 4 Store

No. Look carefully the code I posted. It is not that is wrong - it is simply unneeded and will never run the way it is coded. After the

PHP Code:
foreach ($ids as $cid) { 

the code checks if descr AND keywords are NOT empty but this "foreach" will never be reached if both are not empty in the first place. The "foreach" is included in an "if" statement which checks descr OR keywords being EMPTY.

If one of them is empty then the "foreach" will run but in this case the following "if" will not run - one of them is empty...

You replaced the "each" function and added

PHP Code:
if ( 
                !empty(
$product['meta_description']) 
                && !empty(
$product['meta_keywords']) 
            ) { 
                break; 
            } 

without taking into account the parent "if" block. This second "if" will never run and it shouldn't be there.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote