Search and replace part of a url - Joomla! Forum - community, help and support


i want change in generated url component.

for example:
this generated url component:

index.php?option=com_xxx&route=product/product&path=34_36&product_id=32&itemid=503

it's pointing wrong menu itemid, want change itemid=503 itemid=505. itemid related path=34_36, can't change 503 505.
itemid 503 main menu item, 505 1 of childs. links itemid 503, want change this, depending path=xx_xx.

i managed change url putting code below in router.php file component @ bottom:

code: select all

      $uri = jfactory::geturi();
      $pageurl = $uri->tostring();
      
      $pageurl = preg_replace('/(path=34_36)(.*)itemid=503/', '$1$2itemid=505', $pageurl);
      echo $pageurl;

this working, because on top of page can see generated url want. want change url.

and further working 1 url, have around 10 other url's, have change too. think manage if statemements. instance path=34_36 has point itemid 505, path=34_35 has point itemid 504, path 38_50 has point itemid 507.
could hardcoded, because afterwards no more menu's added.

i tried find information, reading documents in docs.joomla.org, code skills limited.
i think have make buildroute , parseroute, can't work.

can me this?






Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support