i have a category in my store, lets call it Program, this category will only have 1 product, lets call it Program product, so, i've developed a module only to show this category and product, the view is diferent from the others categories, so, if i write in my browser the url
myweb.com/index.php/program.html or myweb.com/index.php/program-product.html i can see the custom categories page or the product view page and i don't want that, i want that if someone write this url he will be redirect to another one, how can i do that, if it is posible
thanks
"Do you want the category to show in the category menu but link to your new URL and not show in the old one?"
"yeah, this is exactly what i want, is this possible??"
Try this; Go to the menu Catalog > URL Rewrite Management and find the entry for your category. Crucially it's target path will look something like "catalog/category/view/id/123" ('catalog' is the module, 'category' is the controller, 'view' is the action and 'id/123' is a parameter).
Follow these URL rewrite instructions to delete the above entry then create a replacement. It's only difference will be the target path, use your module's path along with whichever controller, action and parameters are suitable for this case.
By preserving the ID Path of the old rewrite rule you are ensuring it doesn't get overwritten, although I haven't tested this with rebuilding indexes.
Does the category's enabled setting, and the product's visibility setting affect your module's display? If not use those settings to hide them from the catalog but continue using your module as normal.
Related
I would need some help.
I need to create a custom thing on configurable products that is also seo friendly.
In my case I have a configurable product with 4 options which are simple products that are not visible. In case my customer clicks one of these options on page the info is updated and the url is also changed.
And here is the problem, in case the user reloads the page, it obviously responds with 404 since the product is not reachable.
I would need to then create the ability to redirect on the parent keeping the child url and then pre-select the infomation.
Adding that the pre-select is not a problem, I am using the X event to hook to the controller but I cannot in any way change the url.
Could you maybe help me or in case direct me?
Thanks
Hi Guys I answered myself. To get around this problem I create rewrite urls at the prototto jump of my case history where the child fake url points to the parent
I'm not talking about site URL.
I mean like changing from mysite.com/our-team/john-doe to mysite.com/our-volunteers/john-doe
I just want to rename the /our-team/ to /our-volunteers/. There's only one john-doe page. Now, John Doe is NOT our team per se, but he's a volunteer. So, I need to change the slug to "our volunteers."
The current premium I'm using does not create a WordPress typical page for this so I can't modify the url of the page. So, this does not work -> https://www.competethemes.com/blog/change-page-url-wordpress/
Is there like a hook i can use? Permalinks only allow changing the url structure of the entire site.
What you exactly looking for is Page attributes
https://wordpress.com/support/pages/page-options/#parent-page
You have parent page Our volunteers
http://example.com/our-volunteers
And pages of children pages
http://example.com/our-volunteers/john-doe
http://example.com/our-volunteers/foo
http://example.com/our-volunteers/bar
Set our-volunteers as page slug when you create Our volunteers page
Assign pages John doe, foo, bar to Parent page (Our volunteers) from Page attributes section bottom right on 'creating new page' page
One hack could be to edit .htaccess for this particular issue. It's kinda hacky and might get you into other problems. There's also plugins to do rewrites for you.
I have 1 custom table (not wp core table) where are specific products imported. I've set up custom wp page where these products are listed, custom filter created etc. In this step so far everything is OK - products are listed and filtering works, pagination works...
But what I want to extend further now - open each product page (like /product-listing-page/product-name-1) when clicking on product names in product list page... How can be this achieved "out of wp_posts" table?
Why I'm not using wp_posts table: web site have static pages and dynamic posts as news and product table is truncated and re-imported once in a day every night! So, can not really use wp_posts page when product list is dynamic and totally truncated before each import...
Any ideas? Maybe anybody already did such stuff?;-)
I don't know if you developed a plugin to handle all the custom table and code you created, but if you didn't, I strongly encourage you to do so.
Because by making your code as a plugin, you have the oportunity to use all the composants of wordpress, like the rewrite rules system, which, I think, could help you to achieve your goal.
I created a plugin some times ago for a website I have the charge and I needed a custom page to be displayed within the website (worpdress) url system, which is what you want to do if I correctly understand your question.
Unfortunately the plugin has evolved since and I didn't keep a backup of that code, but if I remember correctly how I did it back when, here is the rough approach I followed:
I create a plugin which handle :
custom db table(s)
custom php objects
...
AND (this is the intersting part) add rewrite rule to wordpress rewrite rules system as follow:
set rewrite tag (init action) (if needed)
add rewrite rule (init action)
intercept url and parse it to get the params i need in my custom
page (parse_request action)
The following functions may help you with that :
add_rewrite_tag
add_rewrite_rule
And you need to hook in :
init
parse_request
Hope it helps you start.
the solution was quite quick and easy! For my needs it was enough just to register global query var:
function register_new_query_var($vars) {
$vars[] = 'product_id';
return $vars;
add_filter('query_vars', 'register_new_query_var');
and then I changed theme template for page product-listing-page to work for product listing and individual products with using
if(!get_query_var('product_id')). So, if query empty - do listing stuff, if not empty - do individual product stuff!
For me this is quite enough and I do not need even seo friendly urls (because product list changes every day, so - every day will be new products, links, and there will be to much 404 errors)...
and I can use http://example.com/product-listing-page?product_id=1 and page displays with date which is from custom table! ;-)
In the pages .tpl.php of my theme i can find several lines like
render($action_links)
displaying whole pages with a single command. Sometime i saw that the render argument is a block from my theme .info, but other times i see arguments i cannot identify that render default pages or elements of drupal.
How it works? And where i can find a list of default displayable pages?
In particular, i needed to display the content of the default drupal page "add content" in one of my pages, and i'm pretty sure i can do it using this render method, but i cannot find the correct argument.
EDIT: I found something like
drupal_render(node_add('NODE_TYPE'));
that seems to allow the display of a node add form, but what i need is the main add content page, containing the list of all the type of nodes that a user can add.
Are you new to Drupal? When I read your post, I'm almost sure that you have missed something with the Drupal's working. The variables you found in render() functions are "calculated" somewhere else in the code (in the modules part for the most).
You cannot find a list of constant variables to display them just like this.
I found this article about these mysterious variables that are rendered and I hope it will help: http://newsignature.com/articles/the-magic-behind-drupals-render-elements
If you just want to display the "add content" form somewhere on your site, just call its path (node/add).
EDIT AFTER CLARIFICATIONS:
First of all, you can set on which page you want the user lands after login. (I don't know why you're still talking about user profile template. Maybe I missed something again.)
But if I did understand what you're trying to achieve, I'll do that:
Create a menu (or simply use the "Navigation" menu that seems to be exactly what you need) with all the actions users can do. And I'll place this menu in the main content region. Do create a menu, go to Administration>Structure>Menus>Add menu. And add links like "node/add/article" or "node/add/news" or "node/add/page" or whatever your content-types are.
Place this menu in the region you want. If you want it to be like the main content of the page, place it in the main container. To do so, go to Administration>Structure>Blocks> Drag and drop your menu in the right region and Save.
Configure this block to appear only on the front page (the first page on user arrives after logged in) if you want so. To do so, in the Blocks administration page, click on "Configure" next to your block and check "show block on specific pages: Only the listed pages" and write down <front>
Create roles and permissions for your different sorts of users. That will automatically show them the links they are allowed to see. To set permissions, go to Administration>People>Permissions and check in the "Node" section which content-type each role can create.
I hope I didn't forget anything. Please tell me if it is clear enough.
need some help. At the moment product url is like
my site. com/hp-f7y90ea-acb-1711.html
It shows manufacturer, SKU code and price. However, I would like the url to be like:
my site. com/HP-350 G1-i5-4200-15,6-HD-AG-HD4400-4GB-500GB-DVD-BT-Silve
I am new to magento, which file do I need to edit and how?
Thanks!
Goto admin>System>configuration>Catalog>Search Engine Optimizations
Here you have find Product URL Suffix field make it blank.
Which is remove .html from url
Then set Product url
try below
https://magento.stackexchange.com/questions/24869/manufacturer-in-product-url-key/24878#24878
4200-15,6-HD-AG , in url is not acceptable.
you need to write your own rewrite url module or use Magento rewrite admin interface.but with admin interface you will have to do a lot of data entry.