Magento 2: Left Category Sidebar from Sebwite - categories

I'm using Magento 2 and still struggle implementing this category listing url:
https://github.com/Sebwite/magento2-category-sidebar
What is the proper way to do this line below? Which file should i edit?
You should implement the block Sebwite\Sidebar\Block\Sidebar in your theme to make this extension work.
As i am new to this, i cannot find any instruction regarding this knowing i should have missed something here.
I have try several attempts but it seems the left category still not showing.
I have tried to edit /vendor/magento/theme-frontend-luma/Magento_Catalog/layout/default.xml but still no luck.
Below is my default.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="header-wrapper">
<container name="compare-link-wrapper" label="Compare Link Wrapper" as="compare-link-wrapper" after="top.search" htmlTag="ul" htmlClass="compare wrapper">
<block class="Magento\Framework\View\Element\Template" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="compareProducts" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/js/view/compare-products</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
</referenceContainer>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<block class="Sebwite\Sidebar\Block\Sidebar" name="category-sidebar" template="Sebwite_Sidebar::sidebar.phtml" />
</body>
</page>
Any suggestions is very appreciated.
Thank you

So this works for me.
Go to your magento luma catalog-layout default.xml and change it to below:
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="header-wrapper">
<container name="compare-link-wrapper" label="Compare Link Wrapper" as="compare-link-wrapper" after="top.search" htmlTag="ul" htmlClass="compare wrapper">
<block class="Magento\Framework\View\Element\Template" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="compareProducts" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/js/view/compare-products</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
</referenceContainer>
<referenceContainer name="sidebar.additional">
<block class="Sebwite\Sidebar\Block\Sidebar" name="category-sidebar" template="Sebwite_Sidebar::sidebar.phtml" />
</referenceContainer>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
</body>
</page>

Related

Magento 2 : template file not overridden correctly

I have wrote the below code to override magento 2 frontend customer edit form.
customer_account_edit.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="customer_edit">
<action method="setTemplate">
<argument name="template" xsi:type="string">Test_Modul::customer/form/edit.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
</page>
But it is not working. Please help me to fix it?
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="customer_edit">
<action method="setTemplate">
<argument name="template" xsi:type="string">Emipro_Module::customer/form/edit.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
</page>
I have used above code and its work fine for me.
Also Your code seems right. Did you make your phtml file under proper location like: Vendor/Module_Name/view/frontend/templates/customer/form/edit.phtml
Also check that if there is no any spell mistake in your module name or path.
customer_account_edit.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="customer_edit">
<action method="setTemplate">
<argument name="template" xsi:type="string">Test_Module::customer/form/edit.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
you need to create a template file for this on the Path.
app/code/Test/Module/view/frontend/templates/customer/form/edit.phtml

magento 2 cms_index_index not working

/app/design/frontend/some/theme/Magento_Cms/layout/cms_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block type="\Magento\Cms\Block\Block" name="index.banner">
<arguments>
<argument name="block_id" xsi:type="string">index_banner</argument>
<arguments>
</block>
</referenceContainer>
</body>
It does not show index_banner static on the home page.
What do the error?
What needs to be done in the background or setting?
Their mistakes
<block class="Magento\Cms\Block\Block" name="index_banner">
<arguments>
<argument name="block_id" xsi:type="string">index_banner</argument>
</arguments>

How to remove "My Wish List" and "Compare Products" blocks from Magento 2.0 Luma template?

I have spent a lot of hours trying to remove "My Wish List" and "Compare Products" blocks from Luma template. Besides, I need to change and remove some of the bottom links.
I cannot find where to modify. Can you help me, please?
Thanks
I've tried following step it worked for me.
1. My Wish List
For wish List you need to remove it via Admin > Stores > Configuration > Customers > Wish list > General Options
make to enabled to no and then save it.
2. Compare Product
Here you need to do some coding level changes. follow me
Go to vendor > magento > theme-frontend-luma > Magento_Catalog > layout > default.xml
Open this file find this tag "" and before body end tag put the following code
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
Make sure this will remove compare product from category product
listing however you can uses this to any layout.
Once you done with this don't forget to clearing cache if enable otherwise you will not get desirable output.
Let me know if you have still any query
Magento 2.2.3 - Get rid of the compare
So I had the same issue, but found out I needed to add a way more to the default.xml to get rid of the compare:
<referenceBlock name="catalog.compare.sidebar" remove="true"/> <!-- Remove sidebar -->
<referenceBlock name="catalog.compare.link" remove="true"/> <!-- Remove link in header -->
<referenceBlock name="related.product.addto.compare" remove="true"/> <!-- Related product -->
<referenceBlock name="category.product.addto.compare" remove="true"/> <!-- Category add compare -->
<referenceBlock name="view.addto.compare" remove="true" /> <!-- Product addto compare -->
instead to remove parent block just remove to the point block
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="wishlist_sidebar" remove="true"/>
Update :for Magento 2.1
<referenceContainer name="content">
<referenceBlock name="catalog.compare.sidebar" remove="true" />
<referenceContainer name="sidebar.additional" remove="true" />
</referenceContainer
A quick note for Enterprise users: you may need to remove the "multiple wishlist" block as well:
<referenceBlock name="multiple-wishlist_sidebar" remove="true" />
I used all of these to remove traces of wishlist and compare from category and product page + the related and upsells on product page. Tested on v2.3.5-p1:
<referenceBlock name="wishlist_sidebar" remove="true" />
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="upsell.product.addto.wishlist" remove="true" />
<referenceBlock name="related.product.addto.wishlist" remove="true" />
<referenceBlock name="related.product.addto.compare" remove="true" />
<referenceBlock name="view.addto.wishlist" remove="true" />
<referenceBlock name="view.addto.compare" remove="true" />
Login to Magento back end. Goto Store->Configuration.
Under Customer ->wishlist you can able to disable the option.
(M2.1)
If you don't want to create a custom theme and/or prefer to work from the backend, you can do the following in the backend.
Navigate to the cms page, category or product page you want to alter.
Example for Category Page: under Design -> Layout Update XML add the following code:
<referenceContainer name="content">
<referenceBlock name="catalog.compare.sidebar" remove="true" />
<referenceContainer name="sidebar.additional" remove="true" />
</referenceContainer>
Note: if you want additional blocks to remain in the sidebar, set the additional container to "false" like this:
<referenceContainer name="content">
<referenceContainer name="sidebar.additional" remove="false" />
</referenceContainer>
For removing compare links
<referenceBlock name="catalog.compare.sidebar" remove="true"/> <!-- Remove sidebar -->
<referenceBlock name="catalog.compare.link" remove="true"/> <!-- Remove link in header -->
<referenceBlock name="related.product.addto.compare" remove="true"/> <!-- Related product -->
<referenceBlock name="category.product.addto.compare" remove="true"/> <!-- Category add compare -->
<referenceBlock name="view.addto.compare" remove="true" /> <!-- Product addto compare -->
For wish List:
You can remove it in Admin > Stores > Configuration > Customers > Wish list > General Options make to enabled to no and then save it.
or
<referenceBlock name="wishlist_sidebar" remove="true"/>
It's almost the very same way
<referenceBlock name="block.name.wantoberemoved" remove="true"/>
Remove compare products from the sidebar
<referenceBlock name="catalog.compare.sidebar" remove="true" />
Remove Wishlist from the sidebar
<referenceBlock name="wishlist_sidebar" remove="true" />
Override core module like below:
code/Custom/Wishlist:
code/Custom/Wishlist/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Custom_Wishlist',
__DIR__
);
code/Custom/Wishlist/composer.json
{
"name": "custom/wishlist-magento2",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0"
},
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"version": "1.0.0",
"authors": [
{
"name": "Pramod Kharade",
"email": "support#blazeclan.com",
"homepage": "https://www.blazeclan.com/",
"role": "Developer"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Custom\\wishlist\\": ""
}
}
}
code/Custom/Wishlist/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Custom_Wishlist" setup_version="1.0.0" >
<sequence>
<module name="Magento_Wishlist" />
</sequence>
</module>
</config>
code/Custom/Wishlist/etc/view/frontend/layout/default.xml
<?xml version="1.0"?>
<referenceContainer name="sidebar.additional" remove="true">
<block class="Magento\Wishlist\Block\Customer\Sidebar" name="wishlist_sidebar" as="wishlist" template="Magento_Wishlist::sidebar.phtml"/>
</referenceContainer>
</body>

Importing local classes in Haxe

I'm starting my first serious project in Haxe, but I've hit somewhat of a snag.
The problem is that if I try writing a class in a file other than my Main.hx, it is not being compiled. I've tried using import but that does not seem to work.
I'm using vim as a my ide with a few nice plugins(Youcompleteme, syntastic and vaxe) and the only haxelib is openfl.
Here is the boilerplate being created when I use the command openfl create project :
Project.xml
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="ProjetSession" package="com.sample.projetsession" version="1.0.0" company="Company Name" />
<app main="Main" path="Export" file="ProjetSession" />
<source path="Source" />
<haxelib name="openfl" />
<assets path="Assets" rename="assets" exclude="openfl.svg" />
<icon path="Assets/openfl.svg" />
</project>
ProjetSession.hxproj
<?xml version="1.0" encoding="utf-8"?>
<project version="2">
<!-- Output SWF options -->
<output>
<movie outputType="CustomBuild" />
<movie input="" />
<movie path="project.xml" />
<movie fps="30" />
<movie width="800" />
<movie height="600" />
<movie version="1" />
<movie minorVersion="0" />
<movie platform="Lime" />
<movie background="#FFFFFF" />
<movie preferredSDK=";3;" />
</output>
<!-- Other classes to be compiled into your SWF -->
<classpaths>
<class path="D:\Development\Haxe\openfl" />
<class path="d:\Development\Haxe\lime" />
<class path="Source" />
<class path="Export\html5\haxe" />
</classpaths>
<!-- Build options -->
<build>
<option directives="openfl=3.0.0-beta
lime=2.1.3
tools=2.1.3
no-compilation
openfl-html5
canvas
lime-html5
html5
web
html5" />
<option flashStrict="False" />
<option noInlineOnDebug="False" />
<option mainClass="ApplicationMain" />
<option enabledebug="False" />
<option additional="--remap flash:openfl
--macro allowPackage("flash")" />
</build>
<!-- haxelib libraries -->
<haxelib>
<!-- example: <library name="..." /> -->
</haxelib>
<!-- Class files to compile (other referenced classes will automatically be included) -->
<compileTargets>
<!-- example: <compile path="..." /> -->
</compileTargets>
<!-- Paths to exclude from the Project Explorer tree -->
<hiddenPaths>
<hidden path="obj" />
</hiddenPaths>
<!-- Executed before build -->
<preBuildCommand>"$(CompilerPath)/haxelib" run lime build "$(OutputFile)" $(TargetBuild) -$(BuildConfig) -Dfdb</preBuildCommand>
<!-- Executed after build -->
<postBuildCommand alwaysRun="False" />
<!-- Other project options -->
<options>
<option showHiddenPaths="False" />
<option testMovie="Custom" />
<option testMovieCommand="" />
</options>
<!-- Plugin storage -->
<storage />
</project>
The hml file is automatically generated by vaxe.
Defining a class and importing it, it is not sufficient to have that class compiled in your output. What you need is to actually "use" it. That can be accomplished by referring your class in your main function. To do that just use the class directly or use any other code that refer that class directly or indirectly.
This is a big advantage of the language that doesn't overload the output of your app with unneeded code. That also means that you can use third party libraries with confidence, knowing that only the bits of library you use will be embedded in your output.

jboss error on deploy struts 2 application

I have deployed my struts 2 application on jboss as 7 with eclipse. The console shows no error, but when I try to open "localhost:8080/site" I get a 404 page error. I tried to reach some resources from my browser e.g. localhost:8080/site/img/logo.png and it worked good, so the server is working fine, the application is actually deployed, but it seems I can't reach any jsp file. Any ideas?
The same application works fine on Tomcat 7.
This is the web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>versus</display-name>
<session-config>
<session-timeout>240</session-timeout>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<security-role>
<role-name>Denied</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Deny Direct Access</web-resource-name>
<url-pattern>*.pdf</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Denied</role-name>
</auth-constraint>
</security-constraint>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
This is index.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%# taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Versus</title>
<meta http-equiv="refresh" content="0;url=home?request_locale=en">
</head>
<body>
</body>
</html>
this is a snippet of struts.xml
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="resources.ApplicationResources" />
<constant name="struts.locale" value="en" />
<constant name="struts.multipart.maxSize" value="10000000" />
<constant name="struts.i18n.encoding" value="ISO-8859-1" />
<package name="default" extends="struts-default">
<!-- INTERCEPTOR -->
<interceptors>
<interceptor name="mobile" class="utils.MobileInterceptor" />
<interceptor-stack name="myStack">
<interceptor-ref name="mobile" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myStack" />
<global-results>
<result name="success">/jsp/template.jsp</result>
<result name="input">/jsp/template.jsp</result>
<result name="error">/jsp/error.jsp</result>
<result name="none">/jsp/error.jsp</result>
</global-results>
<!-- GENERAL -->
<action name="index" class="controller.ActionIndex" method="execute" />
<action name="redirect" class="controller.ActionRedirect"
method="execute" />
<action name="login" class="controller.ActionLogin" method="login">
<result name="logged" type="redirectAction">redirect?request_locale=it&page=${page}&l4vUserLat=${l4vUserLat}&l4vUserLon=${l4vUserLon}
</result>
</action>
<action name="logout" class="controller.ActionLogin" method="logout" />