Hi guys.
As a last option before scrapping the entire function I'm hoping that one of you perhaps could help be getting this to work again.
Long story short... I stopped updating Phoenix a long time ago due to some tragedies in the family and I'm now back to supporting and using Phoenix again.
last version i ran was 1.0.8.0 and now I'm running 1.0.8.20 PRO instead.
A lot has changed and a few PHP versions later my php-file doesn't work anymore because of changes to the core and deprecated functions.
What it should do is to list a page for pricerunner with links to all products, prices, etc. but instead I only get the following message:
Warning: session_name(): Session name cannot be changed after headers have already been sent in XXX/includes/system/segments/application/start_session.php on line 13
Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in XXX/includes/system/versioned/1.0.8.3/session.php on line 103
Warning: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent in XXX/includes/system/versioned/1.0.7.7/cookie.php on line 60
Warning: session_start(): Session cannot be started after headers have already been sent in XXX/includes/system/versioned/1.0.8.3/session.php on line 55
Fatal error: Uncaught Error: Undefined constant "configuration" in /XXX/prisfil2.php:174
Stack trace: #0 {main} thrown in XXX/prisfil2.php on line 174
I will attach the entire file if anyone feels like checking into it.
Broken script for pricefeed generations
Broken script for pricefeed generations
You do not have the required permissions to view the files attached to this post.
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Broken script for pricefeed generations
Hi,
you have the database name constants wrong converted to hardcoded database table names. I wonder how this was working in Phoenix 1.0.8.0?
Instead of:
it should be:
Same in all other queries.
Another thing I saw: you should not place any output before application_top. Move the meta tag at a later point after application_top has been loaded.
And in line 91, I guess it should be "https:" instead of "http:"
And finally you still are using the deprecated "tep_.." functions like: "tep_db_query".
These need to be updated to Phoenix methods or it will break in Phoenix 1.0.9.1.
See the cheat set link in my footer for info how to update these.
you have the database name constants wrong converted to hardcoded database table names. I wonder how this was working in Phoenix 1.0.8.0?
Instead of:
Code: Select all
$query_currency = tep_db_query("SELECT configuration_value FROM " . configuration . " WHERE configuration_key = 'DEFAULT_CURRENCY'");
Code: Select all
$query_currency = tep_db_query("SELECT configuration_value FROM configuration WHERE configuration_key = 'DEFAULT_CURRENCY'");
Another thing I saw: you should not place any output before application_top. Move the meta tag at a later point after application_top has been loaded.
And in line 91, I guess it should be "https:" instead of "http:"
And finally you still are using the deprecated "tep_.." functions like: "tep_db_query".
These need to be updated to Phoenix methods or it will break in Phoenix 1.0.9.1.
See the cheat set link in my footer for info how to update these.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
Re: Broken script for pricefeed generations
It's been working fine untill somewhere around 1.0.8.0.
Your cheat set was what i needed and i got it to work again by replacing all active code involving tep_**** and with some rewritten code.
There's still two lines with tep_ that i couldn't find updates to in your cheat set but for now i just worked around them.
It's the following ones:
tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $row['id'], 'NONSSL', false);
$new_price = tep_get_products_special_price($row['id'])))
Thank you Raiwa
Your cheat set was what i needed and i got it to work again by replacing all active code involving tep_**** and with some rewritten code.
There's still two lines with tep_ that i couldn't find updates to in your cheat set but for now i just worked around them.
It's the following ones:
tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $row['id'], 'NONSSL', false);
$new_price = tep_get_products_special_price($row['id'])))
Thank you Raiwa
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: Broken script for pricefeed generations
The first is in row 150, the second is missing.
To find the replacement, search for the tep_get_products_special_price function in includes/functions/general.php.
If you do not find it there, do a sidewide search.
You'll find:
which tells you that, if the product object is not available, the replacement is:
if the product object is available it's done different and you do not need the special price function. You could have a look into a place where it is shown in core.
For example in:
includes\modules\content\product_info\cm_pi_price.php line 24-29:
Which shows that $product->format() is used for product price and it will be the special price for special products and the normal price for products which have no special price.
If you need it unformatted, you can use: format_raw instead of format.
See:
includes\system\versioned\1.0.7.other\1.0.7.12\product.php
Now you can add it to the cheat set :-)
Thank you!
To find the replacement, search for the tep_get_products_special_price function in includes/functions/general.php.
If you do not find it there, do a sidewide search.
You'll find:
Code: Select all
function tep_get_products_special_price($product_id) {
trigger_error('The tep_get_products_special_price function has been deprecated.', E_USER_DEPRECATED);
return product_by_id::build(Product::build_prid($product_id))->get('specials_new_products_price');
}
Code: Select all
product_by_id::build(Product::build_prid($product_id))->get('specials_new_products_price')if the product object is available it's done different and you do not need the special price function. You could have a look into a place where it is shown in core.
For example in:
includes\modules\content\product_info\cm_pi_price.php line 24-29:
Code: Select all
$price = $product->get('is_special')
? sprintf(MODULE_CONTENT_PI_PRICE_DISPLAY_SPECIAL,
$product->format(),
$product->format('price'))
: sprintf(MODULE_CONTENT_PI_PRICE_DISPLAY,
$product->format());
If you need it unformatted, you can use: format_raw instead of format.
See:
includes\system\versioned\1.0.7.other\1.0.7.12\product.php
Now you can add it to the cheat set :-)
Thank you!
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27