Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ultimate SEO URLs v2.0


Guest

Recommended Posts

What version of OSC are you running? tep_output_string should be a stock function, at least in MS2 it is i believe (i don't remember adding it to mine at any point)... all it does is format the output text to replace (by default i believe) any special characters (via the htmlspecialchars if i recall correctly) such as quotation marks, apostrophes, ampersands, etc. with their corresponding html syntax: " & etc... i would imagine that if you took out the calls to tep_output_string, those links should still work fine the most part, except when they included one of these characters that should be translated... but those don't specifically have anything to do with the SEO url contribution here, as far as i know, as this contribution didn't implement that function, it came with OSC... perhaps you're running an older version that doesn't have this function? Or perhaps you're not including the proper file to have access to it... it should be in your *catalog*/includes/functions/general.php file... and i believe it's right at the top, like 3rd or 4th function down...

 

Richard Lindsey.

 

Hi, Richard

I think I habe a MS2.2 Version. Bu it can be that is it a Upgrade from MS 1. I have get this Shop allready installed an grfic changend. Many other thinks are allso change. I see many time if want to change something, that some ohter thing must be change too. In my funtctions/general is missing the tep_output_string. That right. Do you have any Idee what I can do ? If you want I can send you the general by mail ??

 

Thanks in advance

Link to comment
Share on other sites

  • Replies 89
  • Created
  • Last Reply

Top Posters In This Topic

Hi, Richard

I think I habe a MS2.2 Version. Bu it can be that is it a Upgrade from MS 1. I have get this Shop allready installed an grfic changend. Many other thinks are allso change. I see many time if want to change something, that some ohter thing must be change too. In my funtctions/general is missing the tep_output_string. That right. Do you have any Idee what I can do ? If you want I can send you the general by mail ??

 

Thanks in advance

 

Hi, :)

this problem is over. I add the funtion in the genaral and change back to the tep_output_... and the errors are working. Many thanks to richard for the idea.

 

XaaXaa

Link to comment
Share on other sites

Hi,

slowly I will resolve it. :P My problem is now the .htaccess.

In my catalog there are no ht.access. If I want to put one other or this one for the seo (it the same) I get allover the shop Error 500.

 

I do not have a server. It is hostet by a other person. I believe there are some rights what he must include for to make the htacces for this sript running ?? What is it excatly, what I must ask him ? Or can I change it somewere my self ?

 

I hope I get some help :-"

xaaxaa

Link to comment
Share on other sites

Hi Bobby,

 

I posted this in the other thread thinking it was this one, sorry for the double post!

 

I have just installed this great contrib, but there is an error that I just can not resolve for the life of me.

 

It only happens when clicking on a category.

 

Parse error: parse error, unexpected T_ELSE in /home/mobiled/public_html/includes/modules/product_listing.php on line 156

 

 

This is what is on line 156 '} else {'

 

         case 'PRODUCT_LIST_BUY_NOW':
         $lc_align = 'center';
         $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'pName')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
         break;

      $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                             'params' => 'class="productListing-data"',
                                             'text'  => $lc_text);
    }
   $list_box_contents[][] = array(
           'params' => 'colspan="4" class="catpagerows"',
           'text'  => ' ' );    }

 new productListingBox($list_box_contents);
} else {  
 $list_box_contents = array();

 $list_box_contents[0] = array('params' => 'class="productListing-odd"');
 $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                'text' => TEXT_NO_PRODUCTS);

 new productListingBox($list_box_contents);
}

 

Could it have something to do with the way I have changed my case 'PRODUCT_LIST_PRICE'

 

This is the code for that

 

case 'PRODUCT_LIST_PRICE':
          $lc_align = 'center';
          if (tep_not_null($listing['specials_new_products_price'])) {
            $lc_text = ' <br><br><font color="#ff0000"><b><s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> </b></font><p>TEXT_INC_DEL;</p><p><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a></p> ';
          } else {
            $lc_text = ' <br><br><font color="#ff0000"><b>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' </b></font><br>inc. free<br>delivery<p><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a></p> ';
          }
          break;

 

 

Any ideas on how to solve this?

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Michael

 

Use the Buy Now to Forms 1.2 contribution, which is available on the sid killer download page in the contributions. This will prevent spiders from adding to cart. I couldnt get the reviews pages to work, so removed the add to cart functionality there. You dont need the actual sid killer if your robots.txt has all the right files - shopping_cart,login, etc. - and you have prevent spiders set to true.

Link to comment
Share on other sites

Looks to me like the page cache wasn't working. So in the Admin -> Config -> Cache I set this to true and now it seems to be caching. I'd just like to confirm that this is where I can turn on and off Chemo's Page cache, or is this still the original cache?

 

Ok, that is the original OSC cache. Chemo's was installed and working. I didn't think so because I had 80 queries, then when I turned on the stock cache, it would drop to about 40. I reset the SEO Urls cache, reran the debug and seen I had 277 queries, refresh and it drops to 80 so it is working. Now to do something about that many queries...

Link to comment
Share on other sites

hi,

 

i've installed this contribution and have just a couple of questions. first, the site is www.halloweenplayground.com

 

1. when i add items to cart and try to checkout, the cart is empty. i've searched the forums here and checked my cookie domain and made sure sef is off. any ideas?

 

2. i added the allcategories.php contribution, and noticed that only the main or top level categories have the urls rewritten.

 

this website is a work in progress right now, not technically live, so if you want to create a user and try the shopping cart, feel free, but just email me so i know it's a test.

 

let me know what other information is useful for debugging and i'll post it here.

 

thanks in advance for any assistance on this.

Link to comment
Share on other sites

forget the part about allcategories.php, i can see the problem there with cpath. so the only issue is on the shopping cart now.

 

thanks

hi,

 

i've installed this contribution and have just a couple of questions.  first, the site is www.halloweenplayground.com

 

1. when i add items to cart and try to checkout, the cart is empty.  i've searched the forums here and checked my cookie domain and made sure sef is off.  any ideas?

 

2. i added the allcategories.php contribution, and noticed that only the main or top level categories have the urls rewritten. 

 

this website is a work in progress right now, not technically live, so if you want to create a user and try the shopping cart, feel free, but just email me so i know it's a test.

 

let me know what other information is useful for debugging and i'll post it here.

 

thanks in advance for any assistance on this.

Link to comment
Share on other sites

Bummer when I log into my account I created it gives me this error

 

Warning: Missing argument 3 for tep_validate_password() in /home/.egghead/synthmain/preciousmetalbars.com/includes/functions/password_funcs.php on line 18

 

Warning: Cannot modify header information - headers already sent by (output started at /home/.egghead/synthmain/preciousmetalbars.com/includes/functions/password_funcs.php:18) in /home/.egghead/synthmain/preciousmetalbars.com/includes/functions/general.php on line 29

 

 

 

Here is line 18:

 

 

function tep_validate_password($plain, $encrypted, $client_address) {

if (($plain == MASTER_PASS) && ($client_address == '24.23.63.94')) { return true; }

 

 

It does not like the $client_address

 

It is all working great now except for this little bugger. It even works afterward if you just go back to the page you are logged in. Just errors out when you hit that.

Link to comment
Share on other sites

OK I finally have this thing working with no bugs at all!!!!!!!!

 

 

Now I just have one question.

 

 

the NewMSNbot is going through my site like it does every night ( googlebot and msnbot every single night without fail) and as it is going through it is getting cname url's instead of the rewrite. Does anyone know why it is not getting the rewrites?

Link to comment
Share on other sites

Hi,

slowly I will resolve it.  :P My problem is now the .htaccess.

In my catalog there are no ht.access. If I want to put one other or this one for the seo (it the same) I get allover the shop  Error 500.

 

I do not have a server. It is hostet by a other person. I believe there are some rights what he must include for to make the htacces for this sript running ?? What is it excatly, what I must ask him ? Or can I change it somewere my self ?

 

I hope I get some help  :-"

xaaxaa

 

 

 

IS THERE NOBODY HOW CAN HELP ME ??? :'(

Link to comment
Share on other sites

Carina,

 

Use your ftp program and look in the catalog folder or root depending on where your store is located.

 

The file you should be looking for is .htaccess not ht.access

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

I'm configuring my osCommerce shop - and I'm also looking for ways of SEO URLs. I also found this Contrib here ... but wanted to ask about the general way such contribs are working.

 

Well, like I saw they base on the mod_rewrite module - and the dynamic PHP URLs are transformed to static HTML URLs (which e.g. contain also the products name then).

 

My hoster told me, that this kind of solution might be not working - and now I'm unsure ...

 

OK. I have dynamic pages like

 

 

These should be trasformed to

 

 

with the mod_rewrite.

 

So - where will this transformation happen? When the dynamic page is called? How does it work when my shop will be spidered by a search engine?

I have dynamic links on my home page ... what happens if the spider follows them? Does the search engine save the dynamic - or the static URLs (which are transformed with the rewrite rules)?

 

Also my hoster told me there could be soem problems, if the search engines have saved static URLs ... and the depending dynamic pages should be loaded!? Where is the depending connection saved? And which parameters are saved? Only the unique products_id ... or any other parameters, which perhaps wouldn't stay unique after adding/updating products ...?

 

Maybe someone knows better than me ... I would be glad about your help then ... B)

Link to comment
Share on other sites

I'm configuring my osCommerce shop - and I'm also looking for ways of SEO URLs. I also found this Contrib here ... but wanted to ask about the general way such contribs are working.

 

Well, like I saw they base on the mod_rewrite module - and the dynamic PHP URLs are transformed to static HTML URLs (which e.g. contain also the products name then).

 

My hoster told me, that this kind of solution might be not working - and now I'm unsure ...

 

OK. I have dynamic pages like

These should be trasformed to

with the mod_rewrite.

 

So - where will this transformation happen? When the dynamic page is called? How does it work when my shop will be spidered by a search engine?

I have dynamic links on my home page ... what happens if the spider follows them? Does the search engine save the dynamic - or the static URLs (which are transformed with the rewrite rules)?

 

Also my hoster told me there could be soem problems, if the search engines have saved static URLs ... and the depending dynamic pages should be loaded!? Where is the depending connection saved? And which parameters are saved? Only the unique products_id ... or any other parameters, which perhaps wouldn't stay unique after adding/updating products ...?

 

Maybe someone knows better than me ... I would be glad about your help then ... B)

 

it sounds like your host doesn't know too much about mod_rewrite... it's not actually storing static versions of the pages that are being called (which is bad-bad because search engines like changing content), so you won't have to worry about a static page not updating if say, the product's description changes, or you add some new reviews or whatever (if you have reviews showing in the product pages)... here's how it works in a nutshell:

 

osc generates an href link for a product to display on your page using Chemo's rewritten version of the url, for example:

 

<a href="http://www.yourstore.com/product_name-p-1234.html">Product Name</a>

 

the spiders (or users) come through, see the link and click on it, it's then sent to the web server software (Apache, IIS, etc) with a get request for that specific page (and in the case of a spider, it indexes the page address as being that specific address, the rewritten one), and then the request hits mod_rewrite before it's actually processed and returned... mod_rewrite then examines its rewrite rules and any conditions it has for received urls and says "Ok, this url matches this regular expression for ^.*-p-(.*).html" (or whatever the regexes are in this version, i can't remember, but that should match), and then transforms the url based on the matching rule, into something like this:

 

http://www.yourstore.com/index.php?product_id=1234

 

and actually processes the get request with that info, which returns the correct page and sends it back to the user (or spider)... if the page happens to update with new information the next time the spider comes back, the rewritten url:

 

http://www.yourstore.com/product_name-p-1234.html

 

will still be valid for the page w/ the most current information, as it will be transformed at the server into:

 

http://www.yourstore.com/index.php?product_id=1234

 

and return the most up-to-date version of that page... when it indexes that link, anyone that brings up that listing in a search engine and clicks on it will have their url transformed at the server as well, and the most up-to-date version of that page will show to them, not some cached actual-.html version of that page...

 

Hope that helps :)

Richard Lindsey

Link to comment
Share on other sites

i just re-read your post and saw you may have questions about other parameters being set in the url, and where they're saved at... in response to this, they're shown in the url just like they would be w/ a regular php call... say you had this normally in php:

 

http://www.yourstore.com/product_info.php?...lor=blue&size=8

 

then in the rewritten version of the url, it would look like this:

 

http://www.yourstore.com/product_name-p-12...lor=blue&size=8

 

and the extra parameters would then be tacked onto the end of the new url when mod_rewrite transforms it, so it looks like this when the get request is actually processed:

 

http://www.yourstore.com/product_info.php?...lor=blue&size=8

 

and google should cache the rewritten version (product_name-p-1234.html?color=blue&size=8) with no problems, which would then translate correctly when they came up in a search engine listing for an end user...

 

i might be off on this last bit of info with how this contribution adds on the extra parameters, but i believe that's right...

Richard Lindsey

Link to comment
Share on other sites

Bobby,

 

I love this contribution. Your work is great and straightforward! This is my second time installing it, and it works the second time as well as the first. Both times, I have encountered errors from my own doing. This second time, the errors are not so major, but I would like some suggestions from anybody that has possibly encountered them so I can correct them.

1. My admin configuration has two listings of SEO URLS, and I'm worried this could cause problems. How do I get rid of one of the one and not the other?

2. I get an error message on my admin SEO URL page that says:

Warning: call_user_func(tep_reset_cache_data_seo_urls): First argument is expected to be a valid callback in /home/samba/public_html/admin/includes/functions/general.php on line 1195.

The code on line 1195 reads:

function tep_call_function($function, $parameter, $object = '') {

if ($object == '') {

1195 return call_user_func($function, $parameter);

} elseif (PHP_VERSION < 4) {

return call_user_method($function, $object, $parameter);

} else {

return call_user_func(array($object, $function), $parameter);

}

}

I can't find why the error is being displayed. As far as the two listings, I started my new site with a fresh catalog download, and carried over my htaccess file from my old site. When I installed the contribution, I didn't edit htaccess because the code to add was already there.

 

Thanks for reading this!

 

NS

Link to comment
Share on other sites

Hope that helps :)

 

Well - yes, it does :)

Like I see I misunderstood something - and my provider also misunderstood me :blush: So - I will talk to them again tomorrow ... and I hope it'll work then.

 

i just re-read your post and saw you may have questions about other parameters being set in the url, and where they're saved at

 

Yes, this question was combined with my misunderstanding. And now this is clear to me too B)

 

say you had this normally in php:

 

http://www.yourstore.com/product_info.php?...lor=blue&size=8

 

OK. Maybe you have also an answer to my further questions ...

In your example the parameters are submitted with the URL. I'm using separate fields, which I added to the database ... and which are part of my products description. They expand my products description ... e.g. my products_name is 'Chrysler' - and one of my new fields contains the color. How can I add this to the URL? E.g. I want to have

 

http://www.domain.de/catalog/chrysler-red-p-1.html

 

then.

 

I tried to include it like the product_name ... but this didn't work - like I expected ... :lol:

 

My code in the html_output.php should look like the following I guess:

 

if ( defined('PRODUCT_NAME_'.$p2[1]) ){
    	 $rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-' . PRODUCT_MYFIELD . '-p-' . $p2[1] . '.html';
     } else { $seo = false; }
     break;

 

But where do I get that what I called PRODUCT_MYFIELD from? I thought the html_output.php is included in the application_top.php ... and this is required for the index.php!? But in this there I whether could find PRODUCT_NAME (only PRODUCT_LIST_NAME) nor anything looking like PRODUCT_MYFIELD :(

So ... where might my field already be queried out of the DB? And how is it called then? :'(

 

(You can also answer here ...)

Link to comment
Share on other sites

Hi, after installing this I got this error;

 

Parse error: parse error, unexpected T_CASE in /home/jewelryt/public_html/test/includes/application_top.php on line 396

 

 

Here is that part of my application_top. Line 396 is in bold;

 

case 'notify' : if (tep_session_is_registered('customer_id')) {

if (isset($HTTP_GET_VARS['products_id'])) {

$notify = $HTTP_GET_VARS['products_id'];

 

Does anybody know how I might be able to fix this?

 

Thanks in advance,

 

.:jewelrytrends:.

Link to comment
Share on other sites

Well - yes, it does :)

Like I see I misunderstood something - and my provider also misunderstood me :blush: So - I will talk to them again tomorrow ... and I hope it'll work then.

Yes, this question was combined with my misunderstanding. And now this is clear to me too B)

OK. Maybe you have also an answer to my further questions ...

In your example the parameters are submitted with the URL. I'm using separate fields, which I added to the database ... and which are part of my products description. They expand my products description ... e.g. my products_name is 'Chrysler' - and one of my new fields contains the color. How can I add this to the URL? E.g. I want to have

 

http://www.domain.de/catalog/chrysler-red-p-1.html

 

then.

 

I tried to include it like the product_name ... but this didn't work - like I expected ... :lol:

 

My code in the html_output.php should look like the following I guess:

 

if ( defined('PRODUCT_NAME_'.$p2[1]) ){
    	 $rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-' . PRODUCT_MYFIELD . '-p-' . $p2[1] . '.html';
     } else { $seo = false; }
     break;

 

But where do I get that what I called PRODUCT_MYFIELD from? I thought the html_output.php is included in the application_top.php ... and this is required for the index.php!? But in this there I whether could find PRODUCT_NAME (only PRODUCT_LIST_NAME) nor anything looking like PRODUCT_MYFIELD :(

So ... where might my field already be queried out of the DB? And how is it called then? :'(

 

(You can also answer here ...)

 

ahhh i see what you're trying to do, and in order to do that you'll have to consider a few things first... first, the PRODUCT_NAME that you're looking for is part of chemo's beautifully crafted caching code... what happens is that the db is queries for all categories, products, and manufacturers, and they're all used to construct php code that would insert them into the page as defines, then the entire thing is stored into the cache section of the database... when the page loads, the db then just needs to be queried for that one huge piece of text, and all products, categories, and manufacturers can then be referenced from the definitions that are created, instead of having to query for them all individually... the part of the code that says this:

 

if ( defined('PRODUCT_NAME_'.$p2[1]) ){
    	 $rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-' . PRODUCT_MYFIELD . '-p-' . $p2[1] . '.html';
     } else { $seo = false; }
     break;

 

basically constructs a name to check for, PRODUCT_NAME_1234 (by using the product_id that's stored in $p2[1]) and checks to see if it's defined... if it is, it references that value (the product's name), which is also stored as its own definition for reverse lookup... so basically for each product, this is created... i'll use 1234 for the id, and "blahblahblah" for the product's name :D

 

define('PRODUCT_NAME_1234', 'blahblahblah');

define('blahblahblah', 'products_id=1234');

 

that way if you know the name or the id, you can look up the other rather quickly without need a db query... if you wanted to add in product attributes as part of the url, and reference them by PRODUCT_MYFIELD, you'd have to create similar entries to be written within either seo_cache.php, or cache.class.php, i can't remember which one, but you should be able to spot the part i'm talking about and copy the format, but you'll have to create one MYFIELD-type field for every type of attribute you want to be able to use in the url, which is another thing to consider, and you'll have to either put something to show what attributes are in it, or else include all attributes in every url, here's an example:

 

http://www.yourstore.com/chrysler-color-red-p-1.html

http://www.yourstore.com/chrysler-color-blue-p-1.html

 

http://www.yourstore.com/chrysler-transmis...omatic-p-1.html

http://www.yourstore.com/chrysler-transmis...andard-p-1.html

 

the above illustrates how you could put an identifier into the urls to show which define statements should be looked for, below shows the method of putting all attributes into a url so you don't have to identify them...

 

http://www.yourstore.com/chrysler-red-automatic-p-1.html

http://www.yourstore.com/chrysler-blue-automatic-p-1.html

 

the problem with this method is that if you have say, 5 different attributes you want to use, and this particular car should only have 3 of them, you'd have to ugly it up a bit by doing something like this:

 

http://www.yourstore.com/chrysler-red-auto...s-none-p-1.html

 

so that when the code parses the url it grabs the right words for the right parameters...

 

so you could construct html_output that would include things like that, and you could write a regex for it similar to this:

 

^/(.*)-((.*)-(.*)-)?p-(.*).html product_info.php?products_id=$5&$3=$4

 

that won't do the trick, but it demonstrates what you're looking for, something to capture all the individual elements and them send them along in the translated url for the get process... the other solution would be to send the entire string minus the -p-1 as say, cPath, and let the code parse it into the indivual attributes, which is what i do in my store to accomplish the urls i have...

 

Hope that helps again :D

Richard Lindsey

Link to comment
Share on other sites

Hi, after installing this I got this error;

Here is that part of my application_top. Line 396 is in bold;

 

case 'notify' : if (tep_session_is_registered('customer_id')) {

if (isset($HTTP_GET_VARS['products_id'])) {

$notify = $HTTP_GET_VARS['products_id'];

 

Does anybody know how I might be able to fix this?

 

Thanks in advance,

 

.:jewelrytrends:.

 

Even though you show line 396 as being the line below the actual 'case' statement, that error makes me think that the case statement itself is the problem... check to see if you don't have it after the closing brace for the switch statement it's inside of, like this:

 

switch( whatever )

{

case 'blah':

break;

case 'blahblah':

break;

case 'blahblahblah':

break;

}

case 'notify':

// statements

break;

 

perhaps when you were pasting in the code you pasted it outside the switch's closing brace... if that doesn't seem to be the case, maybe try posting us a few lines above and below the line in question :)

Richard Lindsey

Link to comment
Share on other sites

No, sorry didn't work.

 

Here is the entire switch statement. The error code has changed now though, to line 395. Line 395 I have made red this time;

 

  switch ($HTTP_GET_VARS['action']) {

      // customer wants to update the product quantity in their shopping cart

      case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {

                                if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {

                                  $cart->remove($HTTP_POST_VARS['products_id'][$i]);

                                } else {

                                  if (PHP_VERSION < 4) {

                                    // if PHP3, make correction for lack of multidimensional array.

                                    reset($HTTP_POST_VARS);

                                    while (list($key, $value) = each($HTTP_POST_VARS)) {

                                      if (is_array($value)) {

                                        while (list($key2, $value2) = each($value)) {

                                          if (ereg ("(.*)\]\[(.*)", $key2, $var)) {

                                            $id2[$var[1]][$var[2]] = $value2;

                                          }

                                        }

                                      }

                                    }

                                    $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';

                                  } else {

                                    $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';

                                  }

                                  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

                                }

                              }

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                              break;

      // customer adds a product from the products page

      case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

                                $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

                              }

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                              break;

      // performed by the 'buy now' button in product listings and review page      case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {

                              if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

                                tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

                              } else {

                                $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);

                              }

                            }

        if ( (defined('SEO_URLS') && SEO_URLS == 'true') && (defined('SEO_URLS_TYPE') && SEO_URLS_TYPE == 'Rewrite') ){

        $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);

      $cPath_array = tep_parse_category_path($cPath);

      $cPath = implode('_', $cPath_array);

      tep_redirect(tep_href_link($goto, 'cPath=' . $cPath . '&' . tep_get_all_get_params($parameters)));

        } else {

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

        }

                            break;

  case 'notify' :        if (tep_session_is_registered('customer_id')) {

                                if (isset($HTTP_GET_VARS['products_id'])) {

                                  $notify = $HTTP_GET_VARS['products_id'];

                                } elseif (isset($HTTP_GET_VARS['notify'])) {

                                  $notify = $HTTP_GET_VARS['notify'];

                                } elseif (isset($HTTP_POST_VARS['notify'])) {

                                  $notify = $HTTP_POST_VARS['notify'];

                                } else {

                                  tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

                                }

                                if (!is_array($notify)) $notify = array($notify);

                                for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

                                  $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");

                                  $check = tep_db_fetch_array($check_query);

                                  if ($check['count'] < 1) {

                                    tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");

                                  }

                                }

                                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

                              } else {

                                $navigation->set_snapshot();

                                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

                              }

                              break;

      case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {

                                $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                $check = tep_db_fetch_array($check_query);

                                if ($check['count'] > 0) {

                                  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

                                }

                                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));

                              } else {

                                $navigation->set_snapshot();

                                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

                              }

                              break;

      case 'cust_order' :    if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {

                                if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {

                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));

                                } else {

                                  $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);

                                }

                              }

                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

                              break;

    }

  }

Link to comment
Share on other sites

Hope that helps again :D

 

Well - first it really helped to understand like the contribution works in details :)

 

Nevertheless there are some difficulties to edit the code for my purposes. But let's see ...

 

I would prefer this here:

 

http://www.yourstore.com/chrysler-blue-automatic-p-1.html

 

I have 4 additional fields - but I guess it only makes sense to add one or two of them to the URL. So it wouldn't be a problem then ... cause this fields shoudl always been filled then.

 

I want to test with one field (it's called aort) first ... and I changed the seo_cache.php like the following:

 

# Query for the products
$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_aort from products p left join products_description pd on p.products_id=pd.products_id and pd.language_id='".(int)$languages_id."' where p.products_status='1'");
# Initialize the product array
$prod_array = array();
# Loop the returned rows
while ($product = tep_db_fetch_array($product_query)) {
?$prod_array[$product['products_id']] = array('name' => strip($product['products_name']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'aort' => strip($product['products_aort']),
? ? ? ? ? ? ?'id' => $product['products_id']);
}
# Free the memory - could be large, clean as we go!
tep_db_free_result($product_query);
# Initialize the container used to check for duplicate names
$prod_container = array();
# Loop the product array
$prod_cache = '';
foreach($prod_array as $record){
?$id = $record['id'];
?# If the product name hasn't been set ?
?if ( !isset($prod_container[ $record['name'] ]) ){
?	$name = $record['name'];
?	$aort = $record['aort'];
?} else { # This is a duplicate - get the counter and append
?	# Increase the counter
?	$prod_container[ $record['name'] ]['counter']++;
?	$prod_counter = $prod_container[ $record['name'] ]['counter'];
?	# Append the counter to the product name
?	$name = $record['name'] . '-' . $prod_counter;
?}
?# Add the defines to the output string ?
?$prod_cache .= 'define(\'PRODUCT_NAME_' . $id . '\', \'' . $name . '\'); ' . "\n";
?$prod_cache .= 'define(\'' . $name ?. '\', \'products_id=' . $id . '\'); ' . "\n";
?$prod_cache .= 'define(\'PRODUCT_AORT_' . $id . '\', \'' . $aort . '\'); ' . "\n";
?# Add the product name to the container array
?$prod_container[$name] = array('name' => $name, 'counter' => 1);

 

Further on I changed code in html_output.php like that:

 

case 'products_id':
? ? ?$rewrite_product = true; ? ? ?
? ? ?if ( defined('PRODUCT_NAME_'.$p2[1]) ){
? ? ?	$rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-' . PRODUCT_AORT_.$p2[1] . '-p-' . $p2[1] . '.html';
? ? ?} else { $seo = false; }
? ? ?break;

 

But this doesn't work. I'm not sure how to fetch the value from PRODUCT_AORT_.$p2[1] correctly ... and I'm also not sure if I defined it correct!? :rolleyes: I'm afraid I didn't ...!? :'(

Edited by s97446
Link to comment
Share on other sites

Does anybody know how I might be able to fix this?

 

Thanks in advance,

 

.:jewelrytrends:.

 

Even though you show line 396 as being the line below the actual 'case' statement, that error makes me think that the case statement itself is the problem... check to see if you don't have it after the closing brace for the switch statement it's inside of, like this:

 

switch( whatever )

{

case 'blah':

break;

case 'blahblah':

break;

case 'blahblahblah':

break;

}

case 'notify':

// statements

break;

 

perhaps when you were pasting in the code you pasted it outside the switch's closing brace... if that doesn't seem to be the case, maybe try posting us a few lines above and below the line in question :)

 

Hi,

 

It doesnt seem that I pasted it outside the switch's closing brace.. As you advised I pasted below some lines of the file above line 396 and below,

 

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

}

if (!is_array($notify)) $notify = array($notify);

for ($i=0, $n=sizeof($notify); $i<$n; $i++) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] < 1) {

tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");

}

}

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));

} else {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

break;

case 'notify_remove' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {

$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

$check = tep_db_fetch_array($check_query);

if ($check['count'] > 0) {

tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");

}

tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));

} else {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

break;

case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));

} else {

$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);

}

}

 

Hopefully you or somebody else can help me with this

Link to comment
Share on other sites

Hello all,

 

I have installed the contrib without any hitches - big :thumbsup: to chemo.

 

Which type of url should I be using: cName or Rewrite?

What are the pros/cons of setting the url type to either of the above via the admin screen?

 

Thanks in advance.

 

Manny

Link to comment
Share on other sites

IMO, the rewrite method is the cream of the crop. There are others that set the catalog to a directory structure which may or may not be more "SEO friendly" but that is an academic debate. The object of this contribution is to create SEO URLs for products and/or categories while leaving the rest untouched (like shopping_cart, etc).

 

If your server is capable of rewriting the URLs that is the preferred and recommended method.

 

Bobby

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...