Delete an item from the cart module

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135620

-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : 2.1.3
-- Joomla version -- : 3.1.5
-- PHP version -- : 5.4

JoomSEF + Hikashop

I have a problem with a cart module when I edit part of SEF URL to include Thai language.

If I don't include Thai in URLs or turn JoomSEF off, everything is perfect.

When I included Thai language in the URL, I found that something wrong with Base64 encode and decode.

\components\com_hikashop\views\product\tmpl\cart.php

line: 329 .... urlencode(base64_encode(urldecode($this->params->get('url'))))

When I tried to decode the result of line: 329, I got a very weird URL. Not the right URL.

No matter what I set the "URL when the cart is empty" or not, it happens when I include Thai in URLs.

Do you have any idea? Does Base64 support Thai characters ( UTF-8 ) ?

Thanks

Last edit: 11 years 5 months ago by eMicroMart.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135621

The second question, I don't understand why you have to decode first, encode and encode again.
Can I just put base64_encode($this->params->get('url')) ?

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135632

you can see more information in the pictures.

echo urlencode(base64_encode(urldecode('http://www.hikashop.com/กล้องดูนก-กล้องส่องพระเครื่อง')));

Attachments:
Last edit: 11 years 5 months ago by eMicroMart.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135633

if I change the code to

echo base64_encode('http://www.hikashop.com/กล้องดูนก-กล้องส่องพระเครื่อง');
the decoder shows the right result.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135635

Do rawurlencode(str) and rawurldecode(str) can solve this problem?

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135641

Oops !! the comment #3 and #4, I overlooked the fact that I can't do base64_decode immediately but I need to do urldecode first.

base64_decode(urldecode(url))

Anyway, I think the problem comes from how hikashop decode the return_url when users delete an item from the cart module. Could you help me, please?

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 5 months ago #135647

I think I found something.

From the line 422 in C:\xampp\htdocs\thaioptics\components\com_hikashop\controllers\product.php

$url = JRequest::getVar('url','');

it returns the wrong URL. I found that getVar gets the url varialble from superglobal $_REQUEST.

The url in the $_REQUEST is already encoded but the encoded url is wrong when the url has some Thai characters.

Although, I know what happens but I still have no idea how to fix it. :sick:

Last edit: 11 years 5 months ago by eMicroMart.

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
11 years 5 months ago #135828

Hi,

I don't think that changing such code will help in any way.
Note that in all your messages, you didn't say once what was your problem... so it's hard to help you.
You just said that the URLs were wrong but you didn't give any links so we can't even see what's going on. What are the URLs that don't work when the SEF is turned off ? Why do you think that the problem is in hikashop and not in JoomSEF (it's joomsef which handles the SEFing of the URLs so I would consider that to be a problem with JoomSEF not HikaShop actually) ?

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 4 months ago #137988

I'm using Hikashop now for about a week (free version) to try it. And first of all I would like to make my compliments regarding this product. It looks very good so far! It is unbelievable it is for free! I will very likely upgrade to the business edition after setting up a first version of my webshop without problems, first to get the extra functionality and second to support Hikashop financially! Keep the good work going.

Regarding the discussed problem. I'm also encountering a problem with the delete X button in the Cart module when SEF is on in the global configuration of Joomla. What happens is that after deleting there is a redirect to photonland.nl/photonland.nl/hikashop-men...y/15-polykristallijn while this should be photonland.nl/hikashop-menu-for-categori...y/15-polykristallijn . This results in a 404 error. When SEF is off the problem doesn't occur and there is only one time "photonland.nl". Any good advice how to proceed? Is this a Joomla problem?

Thanks for helping me out!

Regards

Frans

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 2
11 years 4 months ago #137989

Your problem is different. However, I can feel that your problem should be fixed easily by changing some configurations. I remembered that I found this kind of problems many years ago while I was running Joomla 1.5 + VirtueMart + SH404SEF.

Anyway, let's me guess B) please check your live_site url in Joomla configuration OR set "URL when the cart is empty" in Hikashop.

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 4 months ago #137991

Thanks for the swift reply! :)

Half an hour ago I made "Live site" empty and indeed that did the trick (found the proposal on another topic as well). I don't want to go to a predefined website but stay on the same website. Regarding Joomla 1.5, I'm up to date on the latest version of 2.5.

However, all my Google hits are broken now :S :( .

Isn't it possible to fix this in the php code of product instead?

Thxs Frans

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
11 years 4 months ago #138017

That would indicate that you didn't had

http://
at the beginning of a URL (in the live_site variable, or in the "URL when the cart is empty' option of the configuration).

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 4 months ago #138019

First of all, thanks for investigating my problem.

LiveSite is set as follows: public $live_site = ' photonland.nl ';

However after making my Cart empty in the Cart Module it tries to open the following page: " photonland.nl/photonland.nl/hikashop-men...y/15-polykristallijn ", which is causing a 404 article not found error because of the double/extra generated "photonland.nl"

When I set LiveSite to public $live_site = '' and after making the Cart Module empty, " photonland.nl/photonland.nl/hikashop-men...y/15-polykristallijn " is not causing an error anymore. But now every and any article on the site starts with " photonland.nl/photonland.nl/../ .. , so for me this is a solution, but not a very clean and good one.

When I set SEF friendly URL option to "No" in the joomla configuration settings and after making the Cart Module empty the URL "returned" is " photonland.nl/index.php?option=com_hikas...istallijn&Itemid=266 ", which is exactly the same URL as before emptying the Cart Module.

I'm not an experienced PHP programmer (in my younger day's I used to program a lot though), but what I don't understand is that Joomla SEF only in combination with Hikashop returns an extra "photonland.nl/" in the beginning. :blink:

I must be missing something, clearly there is a lot left to learn for me in PHP and Joomla ... :)

Maybe a very stupid question but isn't it possible to cut/peel of the first "photonland.nl" off the string? I tried to find the location but there was "encoding" and "decoding" there and I have no experience with Apache and PHP at all. So for me it's only speculating what is going on there :huh: (did some adaption at another place though for layout purpose, needed product width set to 50% instead of 49% and found the right place to do so :) left the "-1".)

However, compliments for Hikashop so far. Looks very good! Everything is working fine (except for above) in combination with responsive Joomlart template (Virtuemart directly caused unwanted behaviour).

Regarding my problem, my website is www.photonland.nl

Thanks in advance for your answer!

Regards Frans

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 4 months ago #138021

In my former reaction I see that live_site is missing "http://" but it is there in the configuration.php ...

Trying to paste it one more time:
"public $live_site = ' photonland.nl ';"

Regards,

Frans

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
11 years 4 months ago #138029

How about the "URL when the cart is empty' option of the configuration ?

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
11 years 4 months ago #138056

Goodmorning Nicolas,

Just tried that option. But it doesn't make a difference for the Hikashop Cart Module. I set the URL in the configuration screen for the cart to " photonland.nl/index.php?option=com_hikas...t=listing&Itemid=266 ".

But to make things clear, the problem is not related to Cart is empty. For instance, when I have two types of items X and Y displayed in the Hikashop Cart Module and I have ordered every item one time. So quantity of X=1 and Y=1 and with the delete button (x) I want to remove item X. After doing so the Cart is not empty. What happens is the following. When I click the remove button for item X in the Hikashop Cart Module you can see that the quantity is correctly set to "0". Then a split second later a referral to " photonland.nl/photonland.nl/hikashop-men...y/15-polykristallijn " takes place and this URL is wrong while it contains one "photonland.nl" too much. So the 404 screen pops up. URL should be "http:///photonland.nl/hikashop-menu-for-categories-listing/category/15-polykristallijn" in order to make things correctly working.


Regards Frans

Last edit: 11 years 4 months ago by photonfrans.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 4 months ago #138218

Hi,

I just wanted to try your shopping cart, but the given links returns 404 error, and there is no more products in the webshop part.
Thanks to put back products in order to test and debug the problem.

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
11 years 3 months ago #142926

I have the same problem as photonfrans. When I delete a product through the cart module, the products is deleted, but instead of being redirected to the correct and empty shopping cart module URL, I am redirected to a URL that has an added "HESCOM" at the end of the domain name. This of course causes a 404 error. HESCOM is the sub-directory in my hosting account where Joomla 2.5.18 is installed.

To clarify, the right redirection URL after a delete from the cart module would be:
http:www.domain_name/shopping-cart.html
instead I am redirected to a URL that includes my sub-directory:
http:www.domain_name/HESCOM/shopping-cart.html

When SEF is turned off in the Joomla Global Configuration it all works OK. So when I delete the product from the cart module I am redirected to the same page, the cart module page, and the product is gone.

I have tried everything suggested on this thread. I would appreciate any suggestions. Thanks!

Last edit: 11 years 3 months ago by hesolares. Reason: clarification

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
11 years 3 months ago #143011

It's likely that the "live site" parameter of your joomla configuration is not correct. Please check that setting.

The following user(s) said Thank You: hesolares

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
11 years 3 months ago #143045

Thank you for your quick response. I tried every variation I could think of using "http://" and not using "http://" with the website base url. I tried placing a "/" at the end of the base URL and I tried not having a "/" at the end. I tried using a URL with and without the "www" and I tried using all these variations with and without the sub-directory. None of these worked, I still got a 404.

Finally, I decided to just use the Joomla's Redirection Manager and that solved the problem. I'm OK with this solution only because the cart module page is the only one with this problem. If you see a problem with this solution I would appreciate the input. Thanks!

Please Log in or Create an account to join the conversation.

Time to create page: 0.149 seconds
Powered by Kunena Forum