Prestashop 1.7 Breadcrumb titles - prestashop-1.7

I am trying to edit the breadcrumbs in a custom Prestashop theme that I am making based on the Classic theme in version 1.7.6.8. The website I am working on has Prestashop located in a folder at mydomain.com/shop, so I would like the breadcrumbs to read:
Home / Shop / Products
Where Home links to mydomain.com and Shop goes to mydomain.com/shop.
I have added the link for Home to mydomain.com ok. Now I want to change the default Prestashop breadcrumbs because it currently reads:
Home / Home / Products
The second home goes to the right link (mydomain.com/shop) but I don't know how to change it to read Shop instead of Home. I have found a way to edit the controllers so as to remove the second home link, this would allow me to just add a new link with Shop next to the new Home link that I already added, however this doesn't seem like a very elegant solution and will require altering the script on lots of pages. Surely there must be a better way?
Thanks for any feedback.
Edit: Here is the code from controllers/productController.php
public function getBreadcrumbLinks()
{
/*$breadcrumb = parent::getBreadcrumbLinks();*/
$categoryDefault = new Category($this->product->id_category_default, $this->context->language->id);
foreach ($categoryDefault->getAllParents() as $category) {
if ($category->id_parent != 0 && !$category->is_root_category) {
$breadcrumb['links'][] = $this->getCategoryPath($category);
}
}
if (!$categoryDefault->is_root_category) {
$breadcrumb['links'][] = $this->getCategoryPath($categoryDefault);
}
/*$breadcrumb['links'][] = array(
'title' => $this->product->name,
'url' => $this->context->link->getProductLink($this->product, null, null, null, null, null, (int) $this->getIdProductAttributeByRequest()),
);*/
return $breadcrumb;
}
You can see the two sections I have removed, the first removes the default "Home" link, the second removes the link with the product name that I do not need. Obviously the code goes somewhere to look up the link and matches it to a name, I just don't know where.

I found the answer, you can change the tag from "Home" to "Shop" by altering the files in shoproot/var/cache/prod/translations/catalogue.[your language].php
There are a number of places where "Home" appears in the file, to change the breadcrumb it is around line 6370 in the en-gb version.
EDIT: Here is a better option, from your Prestashop control panel you can go to international, translations, modify translations. From the drop downs select theme translation, the theme you are working on, the language, click modify, search for "home" and then put the translation as "shop". This saves you having to make the change to the cached file if you have to clear the cache from the control panel.

Related

Edit JomSocial Joomla Registration Page & Adding Content

I'm running JomSocial 3.2 on Joomla 3.
I want to add some content to the right side of the registration page.
Some pictures and other contents.
So far, i've been able to get to the "register.index.php" file,
which is the file that displays some of the content in the homepag.
The file is in: "/site_root/components/com_community/templates/default/" folder
but i've not been able to fully edit the whole registration page.
This could be done in many different ways - even without editing any file. Install this extension: http://extensions.joomla.org/extension/advanced-module-manager and when editing module you'll have additional tab called "tasks" There will be field URL, type inside URLs of your registration form. Thanks to this you'll be able to assign modules to registration form.
You could also override for:
ROOT/components/com_community/templates/default/register.index.php
Copy it to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
Then you may create module position inside file using this code:
$modules = JModuleHelper::getModules( 'reg-positon' );
foreach ($modules as $module) {
$_options = array( 'style' => 'xhtml' );
echo JModuleHelper::renderModule( $module, $_options );
}
Above code creates module position: "reg-positon'. You'll need to type this name manually as it will be not listed on module positions list.
Now you'll need a bit of html to display it on right or left of registration form.

Custom SEO article title in Joomla

While it's possible to manually enter the full title of a page displaying a category, how would I go about doing the same for an article page in Joomla 2.5?
The default is to use the article title as the page title, e.g. "How to care for goldfish", with an option to add the site name.
What I want is to have the title as follows:
How to care for goldfish | Fish care guides | FishSite.com
The obvious solution would be just to put all that in the title of the article, but then I'd have a problem in the "Latest articles" module, it would become unreadable with all the extra text.
How to solve this? Plugin, coding, or some clever solution? It needs to be more or less automatic though, I can access the Joomla database and change each page title manually but that wouldn't be feasible. If manual text entry is needed, it has to be in Joomla.
The plugin system responds to events, so the easiest solution would be a either a Content or System plugin that manipulates the Title by appending the relevant information prior to display.
I think with a content plugin you could use the onContentPrepare event to do all the work.
In rough psuedo code (i.e. this won't run), I would probably end up with something like this:
public function onContentPrepare($context, &$article, &$params, $page = 0)
{
// Don't run this plugin when the content is being indexed
if ($context == 'com_finder.indexer') {
return true;
}
// Perform a sanity check to make sure we're on an article layout
// Build new title
}

Magento: No 'Add product' button on back end new order

I've just installed the latest version of Magento 1.8 and everything is great and works perfectly. However, we've just discovered that there is no 'Add product' button on the admin new orders page. Everything else works as before, including:
customers can order from the front end
admin can add a product from the 'last ordered' or 'recently viewed products' from the customer recent activity panel
It therefore seems to be an issue with just this button alone. We've tried the below fixes without any success:
removed theme from our site (revert to default); button still missing
noted a previous bug relating to payment methods in v 1.7; tried copying all payment .phtml files to theme; button still missing
At a loss as to what this could be. All other functions appear to be working. Has anyone got any pointers as to how to resolve this?
This isn't exactly an ideal fix, because it involves changing core functionality, but the "Add Product" backend button is handled in:
app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php
What you're looking for specifically is the getButtonsHtml function. Having the same issue after upgrading from 1.6 to 1.9, I changed mine to look like this:
public function getButtonsHtml()
{
$html = '';
// Make buttons to be rendered in opposite order of addition. This makes "Add products" the last one.
$this->_buttons = array_reverse($this->_buttons);
//If the buttons array isn't empty, let it do its thing
if (!empty($this->_buttons))
{
foreach ($this->_buttons as $buttonData) {
$html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($buttonData)->toHtml();
}
}
else {
$addButtonData = array(
'label' => Mage::helper('sales')->__('Add Products'),
'onclick' => "order.productGridShow(this)",
'class' => 'add',
);
$html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
}
return $html;
}
It works, but it's really just a hackjob fix. I'm hoping someone more knowledgeable than I can come up with a proper solution.
Edit - Leaving the above answer, but I sussed out my personal problem. I was running a dual install of Magento, and I forgot to change the .htaccess of my Minify library to re-route to the newer install. So it was compiling the old 1.6 JavaScript and using it on my 1.9 install.

Joomla 3.0 administration protection remove iframe

I have more joomla pages, and i must work at the same time on more admin. panels, so i have created a page where i load pages in iframe, but joomla admin. area is protected from iframe, know someone how can i deactivate this protection?
If i try to open in iframe:www.mypage.com/administrator then i will be redirected to normal page.
I have tried to create new admin template, without any scripts but protection is yet here, i can't found anything with keyword "iframe" or something...
you are looking for the noframes behavior, the com_login view loads
JHtml::_('behavior.noframes');
which ends up calling the noFrames function in the JHtmlBehavior class (libraries/joomla/html/behavior.php)
which loads
$js = "window.addEvent('domready', function () {
if (top == self) {
document.documentElement.style.display = 'block';
}" .
" else {top.location = self.location; }
});";
basically telling the window to change location, so either change how noFrames works or remvoe the JHtml::_('behavior.noframes') call
But note that you shouldnt mod core files as they will get overwritten on updates that need to update that file.

Magento Widget - How to confirm access to block code?

I have created my first Magento widget on a test site (same code and configuration as my live site). The widget works perfectly on the test site. However, having moved the code to the live site, I can configure the widget instance, but the output of the widget is not showing on the product page. So I know Magento is pulling information from the widget's config.xml and widget.xml files.
I have confirmed that the correct layout update is being inserted in the core_layout_update table. The information on the live system's table is exactly the same as that on the working test site.
I have confirmed that the file permissions and ownership are correct on the live site.
I have confirmed that I can put another (Magento supplied) widget in the exact spot on the configurable product page (Product Extra Info). So I know that my templating, etc. is not getting in the way of adding the widget in that spot.
I've tried deleting the widget instance and recreating a new instance of the same widget.
I have compared the code to the test site and copied the code straight from the test site. Still no success. I have enabled php_flag display_errors in .htaccess and no errors are shown. And no errors are showing in the exception.log when enabled.
The live and test systems are on different servers, different OS's, different versions of PHP (both 5.3.x). I've refreshed all the caches and confirmed that the test widget is showing so I don't think this is a caching issue.
How is the best way to confirm that Magento on the live site can actually access or find the Block code for my widget? As indicated I know Magento is accessing the widget.xml file in my local code directory. Not sure if installing Alan Storm's CommerceBug is the way to trace or dump what Magento is trying to load (modules, widgets, etc) for the page in question.
Verify that you have your xml in the /app/etc/modules folder.
You can turn on Block Hints by going to Admin->System->Configuration->Advanced->Developer, change the Current Configuration Scope to Main Website and click on Debug. Change Template Path Hints to Yes and save.
Verify your filenames. This has gotten me a number of times. I develop on a Mac (non case-sensitive), and occasionally when I upload to Linux (case-sensitive), it breaks. One of the first thing I check is the file name's case.
Ensure that the class name matches the filename.
The next step I'd take is to take a look at the final page layout xml generated for the page your'e adding the widget to and ensure a bit of Layout XML is being added to the page for your widget. If it isn't, there's something wrong with the Layout XML Updates that are added to the table via the widget UI. If it is, then start debugging why the particular chunk of generated layout XML isn't being added to the page.
This is the top-down approach to debugging the problem, but it's the only way I know to be sure.
I had the same problem. It's my decision:
app\code\local\Mage\Core\Model\Resource\Layout.php
When 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout') result is not correct: 'theme' => 'multistore', should be 'theme' => 'your_theme'.
So, delete argument 'layout' in function getTheme() and get right result
*/
class Mage_Core_Model_Resource_Layout extends Mage_Core_Model_Resource_Db_Abstract
{
...
public function fetchUpdatesByHandle($handle, $params = array())
{
$bind = array(
'store_id' => Mage::app()->getStore()->getId(),
'area' => Mage::getSingleton('core/design_package')->getArea(),
'package' => Mage::getSingleton('core/design_package')->getPackageName(),
// 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout')
'theme' => Mage::getSingleton('core/design_package')->getTheme()
);
foreach ($params as $key => $value) {
if (isset($bind[$key])) {
$bind[$key] = $value;
}
}
$bind['layout_update_handle'] = $handle;
$result = '';
$readAdapter = $this->_getReadAdapter();
if ($readAdapter) {
$select = $readAdapter->select()
->from(array('layout_update' => $this->getMainTable()), array('xml'))
->join(array('link'=>$this->getTable('core/layout_link')),
'link.layout_update_id=layout_update.layout_update_id',
'')
->where('link.store_id IN (0, :store_id)')
->where('link.area = :area')
->where('link.package = :package')
->where('link.theme = :theme')
->where('layout_update.handle = :layout_update_handle')
->order('layout_update.sort_order ' . Varien_Db_Select::SQL_ASC);
$result = join('', $readAdapter->fetchCol($select, $bind));
}
return $result;
}
}

Resources