how to rewrite url in route codeigniter menually - codeigniter

i want to rewrite url in codeigniter
i have many country when i click the any country name the page display country detail and make this country link in url as
http://localhost/worldtimeserver/Country/detail/india
but i want show link in url as
http://localhost/worldtimeserver/Country/india
i have 240 country and and give them link for display detail of those country
i want to rewrite the url for those country but i don,t know how it is
please help me i'm new in CI

Add following in your routes.php file
$route['Country/(:any)'] = 'Country/detail/$1';
Now when you will browse http://localhost/worldtimeserver/Country/india then it will take into Country controller's detail method with following parameter

Related

Category URL Key redirect to Product Link

For example, I have this category that I want to redirect it to product page, is this possible?
For example I have Kati Birch Forest product, and it's url key is kati-birch-forest
Then I want this Corporate Gifts Url key redirects to kati-birch-forest product INSTEAD of the category's own url key.
How do we do this? Is this possible? Thanks.
You can make use of the Magento admin Url Rewrite Management to get this to be done(Admin->Catalog->Url Rewrite Management). In Magento it is possible to set any url of our choice for products and categories.
Another option is this, Go to app/code/core/Mage/Catalog/Model/Url.php and then go to the function _refreshProductRewrite.
In this function, change: 'request_path' => $requestPath, to: 'request_path' => 'products/'.$requestPath,
This will change the product URL when creating the product, and when reindexing data for the old products and also helpful for SEO.

How magento redirect the checkout page to "edit profile" page

I'm working on a onepage checkout,
In the original version of magento, when I erase the firstname of a user in database, and load checkout page, it will automatically redirect to edit profile page to fill the firstname field.
I want to use this feature, Can you suggest some approches?
Ofcource , if anyone can explain the magento way, I would appreciate that more.
UPDATE :
I want an approach to add another field for user, just like the firstname field. So that whenever that field is empty, the checkout page should redirect to "edit profile" page.
You can add custom field for Customer by following this link https://magento.stackexchange.com/questions/5905/adding-custom-attribute-to-customer-registration-form
or the tutorial http://www.magentocommerce.com/wiki/5_-_modules_and_development/customers_and_accounts/registration_fields
Then add validation condition for your attribute just like other validations in Customer Model file app/code/core/Mage/Customer/Mode/Customer.php. Arround line number 792 look for method public function validate()

Redirect a product to other website

I am looking for a way to have a product on my magento store, make it visible but not purchaseable and redirect users accessing it to another page/external url.
Basically i have 6 products and would like to redirect all users who go to one of those products to another domain / external url. The product should be displayed but not be purchaseable - rather instead of add to cart link to an external url - or if possible even redirect the whole product detail page to another url...
What’d be the best way to do that?
i am trying for two days already but haven’t found the best solution yet… my programming skills aren't the best yet...
thanks!
i think what you should do is to add one new attribute for redirect url , for your six products you can specify the redirect url in that attribute , and in the list.phtml you can place a condition that if a product has value in that attribute , you can use that value in anchor tag and in else case you cam use the regular product links for other products .
i mean you can add a new attribute for a products in admin like there is other attributes eg. name, description , and in file you can fetch your new attribute like other attributes , just replace the attribute code with your and take that in condition that it will work work only if the product has the value for your new attribute
for fetching attribute in your file you can use <?php echo $_product->getAttributeName() ?>

Getting links to a category in Joomla

Even just 30 minutes google the forums and found nothing ... I am interested in - actually I see a new link to a category created not by me, while also having access to the database (to see it directly) being available to only access the admin panel. Help me please.
If you want to create a link to determined category, you have to understand that there is a component responsible of show the content, if you see this Link, you can pass parameters in the url, therefore a link to category will be something like this:
index.php?option=com_content&view=category&layout=blog&id=4&Itemid=6
where category it's the type of view. You can put category or section
Put blog in the layout parameter if you want to show the articles as blog form, this parameter its optional
id its the number of the category id
and finally itemid its the id of the menu from was clicked

Magento. Redirect to specific store view

We have multi-website(5) multi-store-view(13) shop.
What we need is that only 3 store view from 1 shop are allowed to checkout. Therefore the problem is how to redirect users from other shops to the same products on specified store view.
For example user watches product on mk_nn_eng and click #Button#, after that he is redirected to mu_aa_ENG AND sees the same product, he was observing but on specified store view.
How to perform such redirect?
If it's the same item, it will have the same id. And you can link to an item by it's id using the format (assuming you have different domains set up for each view):
www.DomainForStoreViewYouWant.com/catalog/product/view/id/{{product.id}}
Where you would get the id with something like $product->getId(); depending on the product object in the file you're looking at.
So the button you mentioned would just be the above link.
Is this what you had in mind?
Update:
If it's the same domain for each view, you could add the storecode to the end: ?___store=storecode

Resources