I am looking help about smarty global variables. How to get friendly URL variable for using it in smarty template of the Prestashop.
I have found this {$smarty.server.REQUEST_URI} , but I got only full URL.
It looks like:
/en/our-products/73-lighted-mirror-tokyo-70-x-32.html
I need to get only 73-lighted-mirror-tokyo-70-x-32 sting.
Help, please.
You can also use the getUrlRewriteInformations() function from the Product class in PrestaShop.
It can return the information about the URL Rewrites of any product using the following line of code:
$rewrite_info = Product::getUrlRewriteInformations($id_product);
Great, it was help full. I have found the solution for get current product slug on the product page of the Prestashop:
Source URL: /en/our-products/2-backlit-mirror-rectangle-20-x-28.html
{assign var="var" value=$smarty.server.REQUEST_URI}
{assign var="output" value=$var|substr:0:($var|strpos:"."+0)}
{assign var=slug value=$output|substr:($output|strpos:"/"+17)}
{$slug}
Slug: 2-backlit-mirror-rectangle-20-x-28
Related
i have problem, when i change the declination on my product page on prestashop 1.7.1.1
when i looked for the error it look this error image
any one can help me please, im using prestashop 1.7.1.1
I had the same error: "Cannot use object of type Product as array".
In Prestashop 1.7: "Objects are no longer passed to Smarty. We only use arrays now." (http://build.prestashop.com/news/module-development-changes-in-17/#general-information)
In my case, it was a module 'productcomments'. He overwrites the "product" index and changes "array" to "object".
It may be easy to solve.
The message says you are trying to use an object like an array
Imagine you want to fetch the id from the variable:
For arrays
$product['id']
But for objects
$product->id
So search in the template for the incorrect use of the product variable and fix it.
I use Laravel URL::Route for link pages, And I passed query string like following code, but how to add anchor tag for this?
eg: myproject.local/projects?week_ending=value#anchor
How to do that #anchor part with URL::Route? thank you
URL::Route('projects', array('week_ending'=>$week_end_day))
The most obvious way for that will be:
URL::Route('projects', array('week_ending'=>$week_end_day)) . '#anchor'
I have the following url:
http://www.mydomain.com/display/23
// 23 is the companyid, and i want there to be company name
I would like to display it like
http://www.mydomain.com/display/company-name-here
Is it possible to fetch the company name from my controller somehow? Is this possible in the Codeigniter? How can i get the company name from my controller in the routes.php file? I check the CI documentation but I found...nothing.
Regards, John
Open application/config/route.php and add following route path
$route['display/company-name-here'] = 'display/index/23';
Hope display is controller name and you will have to use there index function.
Or another possible way
$route['display/(:any)'] = 'display/index/$1';
Note your link should be http://www.mydomain.com/display/index/company-name-here-23
the link will be converted
http://www.mydomain.com/display/company-name-here-23
Hi i have site in magento. it create duplicates URL after updgradation on cart,crossell,upsell and cart page. I tried many ways also do googling so much. but not get luck..
this is the case
Orginal URL
http://www.test.com/new/inner/myself-antena.html
New, duplicate URL for SKU: ZE-1925
http://www.test.com/catalog/product/view/id/4951/s/myself-antena.html
Can u please help me what i have to do for that?????
I have a static block in Magento with this content:
<li>Contact Us</li>
I would like to replace the # with the site's base url. I want it to retrieve this dynamically.
Try adding this to your static block:
Link to Base URL
That should create a link to your store's base URL.
you can use this {{store direct_url="contacts"}}
For example:
contact us
For those that are still looking for a solution, the following should do the trick for you...
For the unsecured base URL:
{{config path='web/unsecure/base_url'}}
Or for the secured base URL:
{{config path='web/secure/base_url'}}
Try this
Contact Us
You can add store URL in static block:
Your link
A bit more clear and practical scenario (for all level of users) would be:
Suppose, we have added a static-block in footer-area/elsewhere. In that static-block we have words like this: Contact Us
And we want to add a cms-page link of that words(Contact Us).
Nice and simple way with elaborated steps:
Step-1: Create a page through CMS>Pages. In 'Page Information' Tab section we set URL Key* page-contact-us
Necessary Text can be written through the content tab area.
Step-2: After opening up our Static-block through CMS>Static Blocks, we have to write the code like this way:
Contact Us
That's all, the Base URL of that Static-block is now activated and can be retrieved dynamically.