Jump to content

[Resolved] How can I use the isbn as the seo url?


lukejapanwalker

Recommended Posts

Welcome lukejapanwalker! Glad to see you made it to the forums.

ISNB? Maybe ISBN?

In the file /admin/sources/products.index.inc.php, line 46, there is a hook, admin.product.save.pre_process, that can be used to assign to $_POST['seo_path'] the value you entered for the ISBN number. But then, if manually entering the ISBN number, what effort is it to enter it again on the Search Engine tab?

So, I think there is more going on with your request. Perhaps you are importing a CSV into inventory? If so, then you need to have the ISBN number in the CSV record auto-populate a respective record in the CubeCart_seo_paths table. Fortunately, the Import Catalogue feature does that. There just needs to be a column in the CSV that you can "map" to 'SEO Path'.

 

Link to comment
Share on other sites

Hello bsmither,

Thank you very much for your reply, yes I'm using a CSV with a 3rd party program "emagiceone" (which I'm not that fond of) but it lets me import everything very fast.

Unfortunately this software was built for cubecart 5 so does not have the option to set the seo_path on import via csv, so I want to edit the code so that it makes a seo_path using the product code or even better the isbn number instead of the title of the product.

do you know a way of doing this?

 

 

Link to comment
Share on other sites

Just to make clear -- you are importing a CSV using CC6's Import Catalogue feature? This is as opposed to allowing eMagicOne to manipulate the database directly?

After submitting the CSV file to the Import Calalogue function, CC6 will show a list, each row having a name of the CSV column header names and a corresponding drop-down selector that you will "map" the column to the Inventory property.

During this "mapping", for the ISBN column in the CSV, you would choose the ISBN option from the drop-down selector.

When eMagicOne is creating the CSV file, is there an easy way to have it also store the ISBN number in another column, for example the JAN column? If so, then you can "map" the JAN column to the SEO Path option of the drop-down selector.

Link to comment
Share on other sites

If the above is not a valid solution for you, please try this experiment. In /classes/seo.class.php, near line 290:

Find:
} elseif (($prods = $GLOBALS['db']->select('CubeCart_inventory', array('product_id', 'name', 'cat_id'), array('product_id' => (int)$id), false, 1)) !== false) {

Change to:
} elseif (($prods = $GLOBALS['db']->select('CubeCart_inventory', false, array('product_id' => (int)$id), false, 1)) !== false) {
  $prods[0]['name'] = (empty(prods[0]['isbn']))?$prods[0]['name']:$prods[0]['isbn'];

This gets the entire record from the table instead of just a few selected columns. Then, if there is no value for the ISBN, go ahead and use the product's name. Otherwise, use the ISBN as the product's name.

 

Link to comment
Share on other sites

Hello bsmither,

Thank for your help!!

The last code you posted looks like just what I'm looking for!
Maybe I'm missing something or it hasnt been tested, but I get an error(webesite wont load)  when I replace the code above.

I'm sure it's probably just a syntax error, I will have a mess around with it to try and find the error and post it here if I do.

 

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...