Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Responsive osCommerce - Bootstrap


Recommended Posts

  • Replies 2.2k
  • Created
  • Last Reply

BUG?

 

I was having issues removing items that have an attribute set against them in admin (microsoft mouse for example) from cart setting qty to 0 removed item also the product link in shopping_cart went to home page.

If the item has NO attributes the remove button works.

I had modular shopping cart installed and Option Types so I naturally thought one of these was causing the issue.

 

I did a fresh install of master(EDGE) with brand new blank database and the problem still exists with no edits at all the the core install.

I found the thread http://www.oscommerce.com/forums/topic/398381-remove-product-shopping-cartphp-issue-234/ and tied a few of the edits suggested in there but they either were incompatible with current files or they had no effect.

 

 

@Tsimi tried it and it was doing it on mine but his works (same build).

is this a bug / php version issue / session issue strange that it only happens on items with attributes assigned to them where the url has products_id=26{3}8&action=remove_product yet products_id=3&action=remove_product works.

Link to comment
Share on other sites

@@ShaGGy

 

I cannot duplicate this. Perhaps it is your sessions settings, or server setup. But with the redirect to homepage issue happening, it could possibly be your cookie path set in configure file.

 

I did however notice that if not using update button when removing items from cart, the message stack alerting that item has been removed does not show up.

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Link to comment
Share on other sites

@@ShaGGy

 

I cannot duplicate this. Perhaps it is your sessions settings, or server setup. But with the redirect to homepage issue happening, it could possibly be your cookie path set in configure file.

 

I did however notice that if not using update button when removing items from cart, the message stack alerting that item has been removed does not show up.

 

My cookie paths are set up like they were in working 2.3.1

also this issue only happens on items that have a attrib set on the product.

 

I.e if i add item product_info.php?products_id=26 to cart (this as attribs) this will not remove from cart and redirects to home page if you click its title.

if i add product_info.php?products_id=3 (this has no Attrib) this one does remove from cart and redirects to its item page if you click its title.

Link to comment
Share on other sites

@@ShaGGy

 

That is what I tried, but cannot duplicate the issue. Redirects back to product as should, and removes from cart by enter 0 and update or the remove button.

 

What PHP version are you on?

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Link to comment
Share on other sites

My cookie paths are set up like they were in working 2.3.1

also this issue only happens on items that have a attrib set on the product.

 

I.e if i add item product_info.php?products_id=26 to cart (this as attribs) this will not remove from cart and redirects to home page if you click its title.

if i add product_info.php?products_id=3 (this has no Attrib) this one does remove from cart and redirects to its item page if you click its title.

 I have raised a ticket with my host.

 

One thing i have noticed is my host Ipage use a path for the sql connection 'localhost' does not work .. could this be the issue?

Link to comment
Share on other sites

 

One thing i have noticed is my host Ipage use a path for the sql connection 'localhost' does not work .. could this be the issue?

 

If your host runs the MySQL server on the same box as the site, it would usually be either localhost or 127.0.0.1 (loopback address) for the DB location. If the server is running on its own box, that will not work, but will require either a named server ("path"?) or a distinct IP address.

 

If this is happening, none of your DB actions should be working. You shouldn't see some working and some not, unless someone hard coded "localhost" into an add-on or something like that, instead of using the global settings for DB access.

Link to comment
Share on other sites

This is an FYI for a quick hack.

 

I enabled the ht_pages_seo header tag module to fight my duplicate title problem.

 

as i'm rather lazy and was dreading to add more language defines to the different language files.

I used the osc_language_definitions database structure (not the class) that whitehat backported to 2.4 (see github)

Fetched these defines in application top, very similar to the configuration table

// include the language translations
  $_system_locale_numeric = setlocale(LC_NUMERIC, 0);
  require(DIR_WS_LANGUAGES . $language . '.php');

//get some language defines from the database
//right now just SEO data
  $sql_query = 'select definition_key, definition_value 
                  from osc_languages_definitions
                 where languages_id = '.$languages_id.' 
                   and content_group = "'.basename($PHP_SELF,".php").'" ';
  $lang_define_query = tep_db_query($sql_query);
  while ($lang_define = tep_db_fetch_array($lang_define_query)) {
    define($lang_define['definition_key'], $lang_define['definition_value']);
  }
  
and furthermore added a fallback to the HEADING_TITLE in case the META_SEO_TITLE is not defined, and the HEADING_TITLE is.

 

      if ( (defined('META_SEO_TITLE')) && (strlen(META_SEO_TITLE) > 0) ) {
        $oscTemplate->setTitle(tep_output_string(META_SEO_TITLE)  . MODULE_HEADER_TAGS_PAGES_SEO_SEPARATOR . $oscTemplate->getTitle());
      } elseif ( ( defined('HEADING_TITLE')) && (strlen(HEADING_TITLE) > 0)) {
        $oscTemplate->setTitle(tep_output_string(HEADING_TITLE)  . MODULE_HEADER_TAGS_PAGES_SEO_SEPARATOR . $oscTemplate->getTitle());
      }
I'm assuming that everywhere you need more granular control like with categories, products, manufacturers etc you won't have HEADING_TITLE defined.

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

If your host runs the MySQL server on the same box as the site, it would usually be either localhost or 127.0.0.1 (loopback address) for the DB location. If the server is running on its own box, that will not work, but will require either a named server ("path"?) or a distinct IP address.

 

If this is happening, none of your DB actions should be working. You shouldn't see some working and some not, unless someone hard coded "localhost" into an add-on or something like that, instead of using the global settings for DB access.

 

Hi Phil,

 

Yes they have a server path and this appears to be working, i think I have tracked down my issue to being something related to the cookies and cookie paths but still can not get it right,

it is either loosing the cart completely when i go to the home page

or

It will not remove items from the cart using the remove button (if the items contain attributes) it removes items from the cart that do not have attributes which is puzzling me.

 

I did a test install on a free host and that appears to work (out of the box with no changes to config) which then points me to a host issue.

 

I am at a loss to be honest on how to fix this issue.

Link to comment
Share on other sites

it is either loosing the cart completely when i go to the home page

When you say "Home Page", are you talking about osC's front page, or is this a page outside of osC? If you are going outside of osC, you will likely lose the session and thus the cart, unless you add code to your other pages to preserve the session. If you're staying entirely within osC, I don't have any idea what the problem is.

 

It will not remove items from the cart using the remove button (if the items contain attributes) it removes items from the cart that do not have attributes which is puzzling me.

I recall seeing other complaints about "remove item" not working properly when attributes are involved. I think you need to do some searching on this forum for the discussion about this, and the fix (if there is one).

Link to comment
Share on other sites

When you say "Home Page", are you talking about osC's front page, or is this a page outside of osC? If you are going outside of osC, you will likely lose the session and thus the cart, unless you add code to your other pages to preserve the session. If you're staying entirely within osC, I don't have any idea what the problem is.

 

I recall seeing other complaints about "remove item" not working properly when attributes are involved. I think you need to do some searching on this forum for the discussion about this, and the fix (if there is one).

By 'Home Page' I mean OSC front page.

 

 

It will not remove items from the cart using the remove button (if the items contain attributes) it removes items from the cart that do not have attributes which is puzzling me.

I have searched and can only find one that had any form of replys but that appears to have been a seo add on he had installed and there wasn`t a resolution to it.

 

I am convinced even more after today that something on my host is having an issue with the attribute part of the URL it almost as if when you click remove in the cart it doesn`t even run the action.

if you set qty to zero it then removes it

 

I have traced it to the point where if a item in the cart as attributes and the URL contain {xxx} then the remove_product function does not trigger in application_top.

 

I replaced the whole remove_product function with

$messageStack->add_session('product_action', sprintf(PRODUCT_REMOVED, tep_get_products_name($HTTP_GET_VARS['products_id'])), 'warning');

then added two items to the cart one with attribs and one without, if i click remove on the one with nothing happens, if i click remove on the one WITHOUT attribs the message is displayed, so shopping_cart.php is not passing the action through to apllication_top.php when theres a attrib.

 

Sleep time 7.30 am :( i'll have a look at shopping_cart.php later.

Link to comment
Share on other sites

@@burt

 

I have been trying to get to the bottom of products with attributes not removing from the cart

 

although i am convinced this appears to be an issue with my host affecting urls with the attrib {x}x{x}x part they say it is a oscommerce issue and the logs show

 

shopping_cart.php
PHP Warning: Unknown: function '1' not found or invalid function name in Unknown on line 0

 

I have installed the same install on a free host and it works fine.

 

Is this a issue with OSC ?

Link to comment
Share on other sites

I have been trying to get to the bottom of products with attributes not removing from the cart

 

although i am convinced this appears to be an issue with my host affecting urls with the attrib {x}x{x}x part they say it is a oscommerce issue and the logs show

 

shopping_cart.php

PHP Warning: Unknown: function '1' not found or invalid function name in Unknown on line 0

Most occurrences of this error on Google are about trying to set php parameters that are no longer supported - seems unlikely to be related,

but if your host supports choosing php version via your htaccess file, experiment with different versions.

 

I take it that if you put the url to the product with attributes straight into the browser, you end up at the home page? It's losing all the GET variables (when there are none, products_info redirects to index). Have you got search-engine-friendly urls turned on? Have you checked if magic_quotes_gpc is on? Are you doing any url rewriting?

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

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

Link to comment
Share on other sites

Any link in the shop is considered a valid link for ranking by the search engines. Having a link to the page the link is on doesn't make sense to a person but it does to the search engines. I suggest you leave it in.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Most occurrences of this error on Google are about trying to set php parameters that are no longer supported - seems unlikely to be related,

but if your host supports choosing php version via your htaccess file, experiment with different versions.

 

I take it that if you put the url to the product with attributes straight into the browser, you end up at the home page? It's losing all the GET variables (when there are none, products_info redirects to index). Have you got search-engine-friendly urls turned on? Have you checked if magic_quotes_gpc is on? Are you doing any url rewriting?

 

In my case it does not redirect it stays on the cart page.

 

I have placed some print_r in shopping cart and it appears the action=remove_products is not being passed to or reaching application_top which again points to the url containing the attribs part {x}x{x}x is failing as the action functions on items with no attrib parameters in the url.

 

I did have a look through the php.ini last night for any setting that might be having an affect but could not see anything that it could be (I'll have another look today).

Link to comment
Share on other sites

which again points to the url containing the attribs part {x}x{x}x is failing as the action functions on items with no attrib parameters in the url.

I found this, which suggests that PHP at some point will attempt to evaluate {x} as x: http://stackoverflow.com/questions/2596837/curly-braces-in-string-in-php . I don't know if this is formally defined anywhere between Apache, browsers, and PHP, but it may be something that slipped between the cracks, and depends on who exactly wrote what software subsystem!

 

If the authors really want to end up with a string that contains "{x}", it might be prudent to URLencode it before letting it loose into URL parameter passing. That is, { and } would be replaced by %7B and %7D.

Link to comment
Share on other sites

I found this, which suggests that PHP at some point will attempt to evaluate {x} as x: http://stackoverflow.com/questions/2596837/curly-braces-in-string-in-php . I don't know if this is formally defined anywhere between Apache, browsers, and PHP, but it may be something that slipped between the cracks, and depends on who exactly wrote what software subsystem!

 

If the authors really want to end up with a string that contains "{x}", it might be prudent to URLencode it before letting it loose into URL parameter passing. That is, { and } would be replaced by %7B and %7D.

 

@@burt

@@MrPhil You got it, I amended the remove url from

shopping_cart.php?products_id=1{4}1{3}5&action=remove_product

to

shopping_cart.php?products_id=1%7B4%7D1%7B3%7D5&action=remove_product

and it works so it related to the {x} in the urls.

Link to comment
Share on other sites

I fixed this by changing in shopping_cart.php

$products_name .= '  <td valign="top" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                        '  <td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><strong>' . $products[$i]['name'] . '</strong></a>';

to

$products_name .= '  <td valign="top" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . urlencode($products[$i]['id'])) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                        '  <td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . urlencode($products[$i]['id'])) . '"><strong>' . $products[$i]['name'] . '</strong></a>';

and

$products_name .= '<br>' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'style="width: 65px;" min="0"', 'number') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . ' ' . tep_draw_button(CART_BUTTON_UPDATE, 'fa fa-refresh', NULL, NULL, NULL, 'btn-info btn-xs') . ' ' . tep_draw_button(CART_BUTTON_REMOVE, 'fa fa-remove', tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product'), NULL, NULL, 'btn-danger btn-xs');

to

$products_name .= '<br>' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'style="width: 65px;" min="0"', 'number') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . ' ' . tep_draw_button(CART_BUTTON_UPDATE, 'fa fa-refresh', NULL, NULL, NULL, 'btn-info btn-xs') . ' ' . tep_draw_button(CART_BUTTON_REMOVE, 'fa fa-remove', tep_href_link(FILENAME_SHOPPING_CART, ' products_id=' . urlencode($products[$i]['id']) . '&action=remove_product'), NULL, NULL, 'btn-danger btn-xs');

this seems to be working but probably not the ideal way to do it?

Link to comment
Share on other sites

Good to hear you're making progress. urlencode() (http://php.net/manual/en/function.urlencode.php) may do the job, but be careful not to accidentally introduce HTML entity names (which will be processed).

Thats what i have done but only on the two functions (remove from cart and product link in cart) will see if @@burt thinks it needs changing in core as it breaks on my host and possibly others.

I tried on php 5.5 & 5.6

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...