Problem with id_product_attribute in URLs - prestashop

I have a PrestaShop shop with a module for clean id from category urls. My url format for products is "{rewrite}-{id}.html" so PS add "?id_product_attibute=0" on all my products. I want to remove it or put my url format like "{rewrite}-{id}{-:id_product_attribute}.html"
I'm ussing https://github.com/faktiva/prestashop-clean-urls

The id_product_attribute can be removed from the Product URL without changing in the SEO configuration in the back-office.
You can override the getProductLink() function of the Link.php class or make changes in the CORE file.
Remove or comment the $params['id_product_attribute'] = $ipa; from line number 156 in the above function.

Related

How can I control the placement of URL parameters in my route URL?

Suppose I'm creating a website to display customer orders. I want to have pages showing:
A list of customers, which allows me to drill down to...
A list of orders for a given customer, which allows me to drill down to...
Details of a particular order for the customer.
If I create a few Razor pages, I might end up with the following structure:
[Pages]
Index.cshtml
[Customer]
Index.cshtml
[Order]
Index.cshtml
The top-level page (list of customer) has no parameters, so the URL for that is just /.
The customer page (list of orders for a customer) needs a customer ID, so I can put #page "{customerId} at the top of the .cshtml file. It's URL will then be /Customer/123.
So far, so good. That URL makes sense.
Now for the order-detail page. This needs an order number, so let's put #page "{orderNo}" at the top of the .cshtml file. Its URL is... /Customer/Order/54321. Hmmm... I've lost the customer ID from the URL.
I can add the customer ID back in by making the #page directive include it (#page "{customerId}/{orderNo}"), but then the URL is /Customer/Order/123/54321 - which doesn't look good.
How could I get the URL to look like /Customer/123/Order/54321?
You can use an override route template to negate the path-based route that the framework generates. Override routes start with a leading /. In your example the solution is:
#page "/Customer/{customerid}/Order/{orderid}"
Note that this has the benefit of being robust in the face of changes to the structure of the site. You may, for example, decide in the future that nesting the Order folder within the Customer folder impedes discovery, but the override route will ensure that the page is found at the same URL regardless where you move the source files to within the Pages folder.

Custom meta title on checkout/success page in opencart

I am new to opencart and need help with oc 1.5.5.1
I am trying to call custom meta title to add last order id on checkout/success page. I have followed a very helpfull response from shadyyx on Opencart successful order ID and Total from JavaScript
Now I am stuck at a point on how to use the order_id which is already available in session and call / display it in meta title of checkout/success page.
As I understood you, you need to check if the orderid exists and not empty and route is checkout/success so for example add this to $this->data['my-new-metatag']
All above do in the common/header controller (cos meta tags are in the common/header tpl file)
then in common/header.tpl check if $my-new-metatag exists, echo it, otherwise leave variable that echos by default

prestashop mail customisation, and module translation

i have two question
1 - i installed referral program module , and i would like to customise the referralprogram-invitation.html mail template
so i putted the new template under : prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but i doesn't work !
2 - i would like to add some extra text to the program page of referral program module
so i copied the file already included with the module under
prestashop_root/themes/my_theme/modules/referralprogram/translations/fr.php and I added the new text translation in this form
$_MODULE['<{referralprogram}prestashop>program_MD5'] = 'new text';
and it does not work?!!
You only forgot the language folder. Your mail templates must not be in :
prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but in
prestashop_root/themes/my_theme/modules/referralprogram/mails/fr/referralprogram-invitation.html
If you want to add text to the program page, you must:
First, make a copy of the file : prestashop_root/modules/referralprogram/views/templates/front/program.tpl to prestashop_root/themes/my_theme/modules/referralprogram/views/templates/front/program.tpl
Then, you need to modify this file and add the text you want, where you want. To be translatable, your text must be added like this {l s='new text' mod='referralprogram'}.
Finally, you need to translate this text via the Localization > Traductions page of your BO and not directly in the fr.php file.
Do not hesitate if you need more information,
Paul.

Yii: CMenu items for different module

I'd like to make a menu in Layout which the items are linked to other different module.
e.g:
Item "Product" linked to an action in Product Module, item "Service" linked to an action in Service Module.
It won't work when I set the 'url'=>('product/<controllerID>/<actionID>') and 'url'=>('service/<controllerID>/<actionID>') because once we're in Product module and click the menu "Service", the URL become
index.php?r=product/service/<controllerID>/<actionID>
instead of
index.php?r=service/<controllerID>/<actionID>
and it will be 404 error. (for sure, because the Service Module isn't inside Product Module but the URL makes it looks like that).
Any solution for this?
Check the createUrl() documentation :
the URL route. This should be in the format of 'ControllerID/ActionID'. If the ControllerID is not present, the current controller ID will be prefixed to the route. If the route is empty, it is assumed to be the current action. If the controller belongs to a module, the module ID will be prefixed to the route. (If you do not want the module ID prefix, the route should start with a slash '/'.)
That last line tells us everything. Best thing to do for you is start all the routes with a / :
'url'=>array('/<moduleID>/<controllerID>/<actionID>')
Check this
'url'=>$this->createUrl('/<moduleId>/<controllerID>/<actionID>')

Magento API creates simple product correct -> but afterwards tells "101 Product not exists"

I try to add some pictures to a simple product, which was created (without error) by the API. The product is shown in frontend its functional with all wanted attributes. But if I check afterwards
$client->call($sessionId, 'product.info', '123456');
I get Soap Error: "101: Product doesn't exists". But its definitivly reachable over back- and frontend. (Cache cleared, Index refreshed)
Same issue, when I try to add media informations. On Confugurable Products the error don't show up and the pictures are added whithout any problems.
Maybe I messed something up with the attributes or the attribut sets... I don't know, where to watch first.
I'm at my php’s end!
Using Magento 1.6.0.0
Thank your for clarify me.
Best regards.
Since the ame API function ("product.info" in this case) receive as a parameter both SKU and ID, there is a problem if your are looking for SKU's which is numeric values.
To avoid this problem, we always adding space to the end of SKU before sending it to the API. For example, if your SKU is "123456" you should send "123456 " to the API.
Have you tried this call with your product id instead of the sku? I had some problems in the past with product calls and the sku.
I've installed 2 magentos and we always use numeric SKUs and I've always had this problem.
I've solved it by modifying the file:
app/code/core/Mage/Catalog/Model/Api/Resource.php
About line 122 that reads:
$product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);
I've changed it to:
$product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), 'sku');
This way the function always expects an SKU.