I am using osclass3.1 in my site www.carsangrah.com. I have deleted all the categories except one (buy used car). I am able to get non user friendly url for this category i.e. http://www.carsangrah.com/index.php?page=search&sCategory=2. Please suggest me how to get used friendly url for this category.
Thanks.
This is the solution
View::newInstance()->_exportVariableToView('category', osc_get_category('id', $id)); //Optional if the category is already exported
echo osc_search_category_url() ;
Related
For some reason in my shop some of the friendly urls are mixed up. For example I have a product with name "White wine glass 280 ml" and the friendly url is "250-red-wine-glass-300-ml.html". If I go to product edit page and select SEO and click generate URL than the url is corect and all is fine but I don't want to do that for each product in shop.
How can I do that for all the products at once?
I tried finding where are the urls stored in db to delete them and hope presta would autognerate them but I couldn't find where they are saved.
You have to do an override of Dispatcher.php class or use hookModulesRoutes in a Module.
Just create overrides/classes/Dispatcher.php and modify original methods/variable to get what you want to achieve here. You will have to modify how pages are grabed by PHP/Prestashop by altering the script getting the (for exemple) product ID and make a search inside your products url_rewrite to get the good one.
Honestly this is a tought job and lots of modules available are doing it very well, you should have a look as some are very cheap (less than 20$).
I am trying to build a custom 'category' page displaying the products (car parts) that are linked to a certain type of vehicle.
My current URL looks like this:
http://prestashop.dev/cars?manufacturer=BMW&model=3%20Series&year=2003&engine-type=Petrol&engine-size=1.8
But I need it to look like this:
http://prestashop.dev/cars/manufacturer-BMW/model-3-Series/year-2003/engine-type-Petrol/engine-size-1.8
How is this possible? I don't want to go and create a custom URL in the SEO & URLs section for every possible combination as the manufacturer BMW has multiple models each having multiple years, etc.
Also, it needs to be able to move around in the url. Ie: if they only provide a manufacturer and a year, the url must be:
http://prestashop.dev/cars/manufacturer-BMW/year-2003
Any idea on how to do this inside of the module in Prestashop 1.6?
As per our knowledge, it is not possible to achieve this in PrestaShop. We recommend you to use hash in the URL and to make URL SEO friendly don't forget to use ! after hash.
You can check the same by visiting the following URL:
https://www.1motoshop.com/parts#!2015--Harley-Davidson--FLTRXS-Road-Glide-Special
I am learning angular, for that i was use itunes api for my references. I want to list music albums and click that album i want to show details. I have found one url but in that there is no unique id. I want to unique id from each one from the list of albums. I have include that url below,
enter link description here
In this json, I did't get unique id from each item of the list. please provide correct url for get information and detail view of each items. If i get correct url i will practices small application in angular.
The first result from the URL you linked is:
{"wrapperType":"collection", "collectionType":"Album",
{""artistId":211192870, "collectionId":211192863,
{""artistName":"Louis Prima & Gia Maione", "collectionName":"Let's
{"Fly With Mary Poppins", "collectionCensoredName":"Let's Fly With
{"Mary Poppins",
{""artistViewUrl":"https://itunes.apple.com/us/artist/gia-
{"maione/id211192870?uo=4",
{""collectionViewUrl":"https://itunes.apple.com/us/album/lets-fly-
{"with-mary-poppins/id211192863?uo=4", "artworkUrl60":"http://is2.
{"mzstatic.com/image/thumb/Music/v4/5e/4c/b0/5e4cb014-26cd-
{"7b64-6dd6-b845750f88ce/source/60x60bb.jpg", "artworkUrl100":"htt
{"p://is2.mzstatic.com/image/thumb/Music/v4/5e/4c/b0/5e4cb014
{"-26cd-7b64-6dd6-b845750f88ce/source/100x100bb.jpg",
{""collectionPrice":9.99, "collectionExplicitness":"notExplicit",
{""trackCount":12, "copyright":"℗ 1965 Buena Vista Records",
{""country":"USA", "currency":"USD",
{""releaseDate":"2007-01-16T08:00:00Z", "primaryGenreName":"Jazz"}
Here's the URL to get those album details from the collection ID in that result:
https://itunes.apple.com/lookup?id=211192863&entity=album
I solved this using,
https://itunes.apple.com/search?term=jack+johnson&media=music
From this i get track id, and passed in to
https://itunes.apple.com/lookup?id=trackId&media=music
i passed this url and get detail page. Thanks
I am using opencart 1.5.6.
Products on homepage (or somewhere else then the category) link to /product while when cicked from a category page it goed /category/product.
This means google thinks there's duplicate content, I don't like that so how can I solve this(so the url's are allways /categorie(/subcat)/product?
I would like all other pages also to have a clean seo url but when I installed the following extentions there happened nothing:
www.opencart.com/index.php?route=extension/extension/info&extension_id=15557&filter_search=seo%20url&filter_license=0&sort=e.downloaded&order=DESC&page=3
www.opencart.com/index.php?route=extension/extension/info&extension_id=15516
The url of the site:
http://publiekgeheim.com
You don't have to worry for duplicate content. As I can see you have the "canonical" link tag in the <head> of your products so you are ok. This tag tells search engines which url is the "correct" one and that the others are just produced by plugins, categorization, etc. So there is no duplicate content.
In opencart, unless you want to code and make scenarios and change your workflow the best way to generate the canonical tag is as is done now. That is, www.example.com/product . The reason is that the way opencart produces urls such as http://publiekgeheim.com/lingerie/Esprit/Esprit-Feel-Sexy-String, where the category path is included, is really unreliable. Eg, the following url http://publiekgeheim.com/stackoverflow/Goerge/wtf/Esprit-Feel-Sexy-String will also lead you to the product page!
If you still want to do it your way you will have to change this line in catalog/product/product.php:
$this->document->addLink($this->url->link('product/product', 'product_id=' . $this->request->get['product_id']), 'canonical');
And this is where the pain starts. You can use the getCategories method in catalog/model/catalog/product.php and get the categories where the product belongs to. But which one do you want to display? If you only assign one category to your products you are lucky. But if not? In a store of mine I even often assign a product in 2 categories that are essentially the same but belong to different parent categories in order to help users find the product more easily (since opencart doesn't allow putting links (to categories) as menu items in the top menu). If I wanted to follow your approach I would need to either use some extensions that allow me to put links in the top menu, but which create empty, duplicate categories in my sitemaps or use some mega menu that will totally replace the default top menu. And then new problems will arise. So, you see that depending on your use case it gets more and more complex.
And even if you manage to get past this (by for example choosing a random or the first category that is returned, or by assigning from now on a product only to one category) how are you going to find the parent categories in order to display the full path in the url? There is no such method in opencart and coding this is really ugly and will add at least 3 more db queries to the product page (I tried to calculate how many db queries are needed in order to produce the default opencart page and I counted at least 10).
So, all in all, and to avoid having tricky situations stick to the default canonicals unless you come up with a strict policy on how you upload and display products and some clever code.
Those extensions should work. Check your vqmod errors and compatibility.
I've sat with this problem for a couple of days now and have finally figured it out. 1.5.6.4
category/product instead of /product when linking from HOME and Related Products.
1. In /catalog/controller/module/showintabs.php
AFTER:
if ($this->config->get('config_review_status')) {
$rating = $result['rating'];
} else {
$rating = false;
}
ADD:
$categories = $this->model_catalog_product->getCategories($result['product_id']);
if(isset($categories[0]) && !empty($categories[0])){
$path = $categories[0]['category_id'];
}else{
$path = '';
}
AND in $products[] = array right below it
CHANGE:
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
TO
'href' => $this->url->link('product/product', 'path=' . $path . '&product_id=' . $result['product_id']),
2. In /catalog/controller/product/product.php
AFTER
if ($this->config->get('config_review_status')) {
$rating = (int)$result['rating'];
} else {
$rating = false;
}
ADD
$categories = $this->model_catalog_product->getCategories($result['product_id']);
if(isset($categories[0]) && !empty($categories[0])){
$path = $categories[0]['category_id'];
}else{
$path = '';
}
AND in $this->data['products'][] = array( right below it
CHANGE:
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
TO
'href' => $this->url->link('product/product', 'path=' . $path . '&product_id=' . $result['product_id']),
I am wondering why the link to profile looks like:
http://stackoverflow.com/users/ID/NAME
not simply:
http://stackoverflow.com/users/ID
or even better:
http://stackoverflow.com/users/NAME
Can there be couple users with the same name? Or can one user have many names?
All SO-URLs are of the form id/description where the ID is unique and the description is optional. So /users/12890/arne-burmeister is the same as /users/12890/huhu and /questions/420380/why-does-the-link-to-the-user-profile-have-both-id-and-name is the same as /questions/420380/foo. The retrieval just uses the ID, but it is much better for google ranking, when the user/question/what-ever-should-be-found occurs in the URL (also for humans this is much more descriptive ;-).
By the way, retrieval by ID is faster than by such a large text string. And of course, the URL remains valid if someone changes their user name or the question.
The part after the last slash seems to be SEO related (i.e. making the url more expressive).
On the urls that I tested you could replace that part with whatever you wanted, it still worked. So the url http://stackoverflow.com/users/37086/othername still points to your profile.
I would assume doing a database lookup solely on the name string would be more expensive than a numerical lookup on the primary key, even if the name column is indexed. The name is then added on to make the URLs more user and SEO friendly.
There is a uservoice request for this. If you want this to happen, uservoice is the right place to discuss / vote up.
Your name on SO is not unique click on users and type Josh, there's a whole page of us. So you have to have the ID. As for why the name everyone else's guess is as good as mine.
Try changing or removing the name and see what happens.
I think it's just so that your URLs tell you what to expect, but the application doesn't need (or actually use) that information.
Amazon does something quite similar with their books, if I remember correctly: They've got both the ASIN (their internal ID) and the name of the book in the URL, but only ever look up the ASIN.
Just speculating: The ID allows very fast retrieval of the data the profile page presents. The name is just for humans and ignored since it's easier for me to no that you are rkj and I am phihag than that your ID is 37086 and mine is 35070.