lukejapanwalker Posted September 15, 2015 Share Posted September 15, 2015 (edited) I have had a good crack at it and tracked it down to possibly the seo.class.php file.Does anyone know what part of the code I have to change?I know I can do it manually from the admin but I need it to be automatically generated.Thanks Edited September 25, 2015 by lukejapanwalker Resolved Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 16, 2015 Share Posted September 16, 2015 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'. Quote Link to comment Share on other sites More sharing options...
lukejapanwalker Posted September 16, 2015 Author Share Posted September 16, 2015 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? Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 16, 2015 Share Posted September 16, 2015 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 16, 2015 Share Posted September 16, 2015 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. Quote Link to comment Share on other sites More sharing options...
lukejapanwalker Posted September 18, 2015 Author Share Posted September 18, 2015 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 18, 2015 Share Posted September 18, 2015 From: $prods[0]['name'] = (empty(prods[0]['isbn']))?$prods[0]['name']:$prods[0]['isbn']; To: $prods[0]['name'] = (empty($prods[0]['isbn']))?$prods[0]['name']:$prods[0]['isbn']; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.