I had an idea for this that I just tried out, it kind of addresses...
migz wrote:This doesn't work on Opencart 1.4.0. Any suggestions?
...and also...
montanaflynn wrote:Of course this is not optimal, because it relies on javascript and not PHP
Though I agree with...
Qphoria wrote:This isn't really a fix.. more like a new feature.. it auto-enters the seo keyword for you.
So, sorry for the mass quotes at the beginning, now that is out of the way, I had a thought about adding a "auto seo keyword" feature. I though this might be easy to do in the validation phase, as this is used by edits and adds of products. I want to use the friendly URLs on a shop I'm working on, but the shopkeppers are not so tech savy, so I wanted to make it easier for them. Also, there are nearly 20,000 products, so any time-saver is good. Sorry, will cut to the chase. By adding a few lines to the validateForm function in admin/controller/catalog/product.php we can auto generate the keywords from the product name and id. Disclaimer first though, this is v ugly at the mo, and I'll tidy it up, but while I was reading this post, and before I forget I thought I'd chuck it into the thread.
Code: Select all
# add a default keyword
if (strlen(utf8_decode($this->request->post['keyword'])) < 3) {
# pull the value
$temparr = $this->request->post['product_description'];
# get the string from the big multi language and field array
$tempstr = $temparr[1]['name'];
# decode and tidy it
$tempstr = utf8_decode($tempstr);
$tempstr = str_replace( " ", "_", $tempstr );
# add the product id
$tempstr = $tempstr . "_" . $this->request->get['product_id'];
# save it back
$this->request->post['keyword'] = $tempstr;
}
This is on 1.4 by the way. Not intended as code for sharing (too ugly, particularly that language hack) but just to get some thoughts and feedback on the general idea.
Andy