Jump to content

ON SALE problems


phrauch

Recommended Posts

Hello,

Please look at www.glasinlood-delden.nl/webwinkel.
Clicking on "Uitverkoop" (On sale) shows the products that are on sale.

If you click directly on the button to sell the product (button="Koop nu"), my home-page appears in the right-column in stead of going to the shopping-cart.

If at first you click on the product and then buy the product, everything functions correctly.

i'm using version 5.2.16

(I'm Dutch, so hopefully my English is understandable?)

Peter-Jan Rauch

Link to comment
Share on other sites

I don't get the homepage in the right column*, I just get the homepage.

 

I think the problem is coming from a disconnect between what CubeCart wants to use as a search-engine-friendly (SEO) URL for sale-items.html, and what you want to use as an SEO URL verkoop-items.html.

 

Did you make any edits to the core code or skin templates to force using verkoop-items.html?

 

If you can try this short-term experiment, just to see if the above is what's happening, in admin, Store Settings, Search Engines tab, disable the SEO Mode. You won't lose anything. Then, in admin, Maintenance, clear the cache. (The shop by category list doesn't reset the links like everything else.)

 

From Sale Items, click Buy Now and let us know what happens.

 

Then you can re-enable SEO Mode.

Link to comment
Share on other sites

Thank you for your answer; I'm a new user of Cubecart and I am grateful that you answered so soon.

I didn't edit core code or skin templates to force using verkoop-items.html (I even wonder how Cubecart makes this categorie itself and what php-files are used to do that?)

I disabled SEO mode as you wrote and cleared the cache and everything works perfect.

As soon as I re-enable SEO-mode, trouble comes back.

 

I wonder two things:

- why does this only appear in the category "Uitverkoop" (On sale) and not in all other categories?

- Is there any possibility to enable SEO and modify a specific PHP-file that causes the problems?

 

Hope you will look at this again; I attached two screenshots to show what happens.

Link to comment
Share on other sites

I see, but the problem begins when there are more items on sale and you get a list with on sale-items. The buy-button direct next to the items causes the problems. No problem if you see only the product and click the buy-button.

Link to comment
Share on other sites

The actual problem, as I see it, is that CubeCart uses a foreign language SEO URL in one location, but uses the English language SEO URL in another location.

 

The problem is not whether items are on sale, nor how many items are on sale, nor with the actual Buy Now buttons.

 

I'm still verifying the foreign language hypothesis.

Link to comment
Share on other sites

I am sorry to say that nothing on the View Category page (of which Sale Items are a category) that is considered a "form element" will work.

 

Links to other pages will work because these are not inputs to forms.

 

I was able to reproduce the effect locally. This problem may have existed in CubeCart 5 for many, many versions. It may even exist in CubeCart 6.

 

In my experiments, my diagnostic code should reveal where the problem's origin is located. I'm sorting through that diagnostic code now.

 

In the meantime, my only suggestion is to switch out of SEO Mode.

 

We should not take long to find the origin of the problem.

Link to comment
Share on other sites

Disclaimer: This has not been extensively tested. Make a backup of your database. Make a backup of the file you are about to edit.

 

I do not expect anything disastrous to happen, however.

 

Using a programmer's text editor*, in the file /classes/seo.class.php, find near line 545:

    /**
     * Can we use SEO
     *
     * @param string $path
     * @return bool/string
     */
    public function SEOable($path) {
    
    
        $path = preg_replace('@index.php$@', '', $path); // remove index.php if last chars in URL
    
        if ($this->enabled()) {
            if (strpos($path, 'index.php?_a=category&search') !== false) {
                $path = str_replace('index.php?', 'search.html?', $path);
                return $path;
            } else if (($pos = strpos($path, 'index.php?_a=search')) !== false) {
                if (strlen($path) == $pos + 19) {
                    $path = str_replace('index.php?_a=search', 'search.html', $path);
                } else {
                    $path = str_replace('index.php?_a=search&', 'search.html?', $path);
                }
                return $path;
             } else if (($pos = strpos($path, 'index.php?_a=saleitems')) !== false) {
         if (strlen($path) == $pos + 22) {
                    $path = str_replace('index.php?_a=saleitems', 'sale-items.html', $path);
                } else {
                    $path = str_replace('index.php?_a=saleitems&', 'sale-items.html?', $path);
                }
        return $path;    
      }

        }
        if ($this->enabled() && preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)&(amp;)?([w[]]+)=([w-_]+)([^"']*)$#ieS', $path, $match)) {
            return $this->generatePath($match[5], $match[2], $match[4], true, true).$this->queryString($match[6]);
        } else {
            return $path;
        }
    }

Replace all of that with:

    /**
     * Can we use SEO?
     *
     * @param string $path
     * @return string
     */
    public function SEOable($path) {

        $path = preg_replace('@index.php$@', '', $path); // remove index.php if last chars in URL

        if ($this->enabled()){

            if (preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)([^"']*)$#ieS', $path, $match)) { // $path matched the standard URL pattern (short static)
                $path = $this->generatePath(null, $match[2], null, true, true).$this->queryString($match[3]);
            }

            if (preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)&(amp;)?([w[]]+)=([w-_]+)([^"']*)$#ieS', $path, $match)) { // $path matched the standard URL pattern (long dynamic)
                $path = $this->generatePath($match[5], $match[2], $match[4], true, true).$this->queryString($match[6]);
            }

        }

        return $path;
    }

* A programmer's text editor is not Windows' Notepad, or Wordpad, or Word, or Dreamweaver. For Windows, I suggest the free editor NotePad++.

Link to comment
Share on other sites

There is more work to be done. For example:

http://mystore.com/verkoop-items.html

When I use the sorter, what comes back is:

http://mystore.com/verkoop-items.html?_a=saleitems&cat_id=sale&sort[name]=ASC

All this new stuff seems to not interfere with CubeCart understanding what to do, it is just not necessary.

Link to comment
Share on other sites

I did what you wrote and changed /classes/seo.class.php
In admin I set SEO-friendly url at "yes" etc.
On the website Using the category "On sale" everything works fine and I can buy the products.
But: in all the other categories I can't buy anything anymore (see attachments).
Thanks for the work you already did, but hope there's another solution 

Link to comment
Share on other sites

It seems we need to make the second test come first. So:

Was the replaced code:
 
    /**
     * Can we use SEO?
     *
     * @param string $path
     * @return string
     */
    public function SEOable($path) {

        $path = preg_replace('@index.php$@', '', $path); // remove index.php if last chars in URL

        if ($this->enabled()){

            if (preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)([^"']*)$#ieS', $path, $match)) { // $path matched the standard URL pattern (short static)
                $path = $this->generatePath(null, $match[2], null, true, true).$this->queryString($match[3]);
            }

            if (preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)&(amp;)?([w[]]+)=([w-_]+)([^"']*)$#ieS', $path, $match)) { // $path matched the standard URL pattern (long dynamic)
                $path = $this->generatePath($match[5], $match[2], $match[4], true, true).$this->queryString($match[6]);
            }

        }

        return $path;
    }
 
 
Now the replaced code:
 
    /**
     * Can we use SEO?
     *
     * @param string $path
     * @return string
     */
    public function SEOable($path) {

        $path = preg_replace('@index.php$@', '', $path); // remove index.php if last chars in URL

        if ($this->enabled()){

            if (preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)&(amp;)?([w[]]+)=([w-_]+)([^"']*)$#ieS', $path, $match)) { // $path matched the standard URL pattern (long dynamic)
                $path = $this->generatePath($match[5], $match[2], $match[4], true, true).$this->queryString($match[6]);
            }

            if (preg_match('#^(.*/)?[w]+.[a-z]+?_a=([w]+)([^"']*)$#ieS', $path, $match)) { // $path matched the standard URL pattern (short static)
                $path = $this->generatePath(null, $match[2], null, true, true).$this->queryString($match[3]);
            }

        }

        return $path;
    }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...