Foros de discusión

Shopping portlet

thumbnail
Myiah Taylor, modificado hace 14 años.

Shopping portlet

New Member Mensajes: 19 Fecha de incorporación: 23/05/09 Mensajes recientes
can someone answer this question.
i need help on finding infomation on how to split the shopping cart portlet into a number of different portlets is that possiable
if so where can i find documentation?
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
I actually did that to create a web commerce solution for my organization. In essence all I really did was take the jsp files and put them in different directories. Then added entries in the portlet.xml and liferay-portlet.xml files.

Of course I had to change some of the code in the jsp pages and create new references in the jsp files.

I split the portlet into the following portlets:

- browse
- cart
- catalogsearch
- check
- item
- navigation
- quickcart
- quickorderpad
- quickitemadd
- paidinvoices
- openinvoices
thumbnail
Myiah Taylor, modificado hace 14 años.

RE: Shopping portlet

New Member Mensajes: 19 Fecha de incorporación: 23/05/09 Mensajes recientes
Thanks for your help..ill look into that more. finding some infomation on how to split it up like you did!!!
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
I created a directory for each portlet that I created. Then I put the jsp page in that directory with the name of view.jsp. If I had to initialize any variables (which was in the init.jsp in the shopping portlet) I created a new init.jsp. Of course I had to add entries in the web.xml file as well. Then I created an entry in portlet.xml and liferay-portlet.xml.

It was basically trial and error to see what errors I received while trying to use each component.

For example:
Checkout:
I still have a checkout_first.jsp, checkout_second.jsp and a checkout_third.jsp. But my main page is view.jsp and I have an init.jsp page.

The init.jsp page has the following:

<%@ include file="/html/portlet/webstore/init.jsp" %>

<portlet:defineObjects />

<liferay-theme:defineObjects />

<%
PortalPreferences portalPrefs = PortletPreferencesFactoryUtil.getPortalPreferences(request);

StorefrontPreferences storefrontPrefs = StorefrontPreferences.getInstance(company.getCompanyId(), portletGroupId.longValue());

Currency currency = Currency.getInstance(storefrontPrefs.getCurrencyId());

NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(locale);

currencyFormat.setCurrency(currency);

DateFormat dateFormatDateTime = DateFormats.getDateTime(locale, timeZone);

NumberFormat doubleFormat = NumberFormat.getNumberInstance(locale);

doubleFormat.setMaximumFractionDigits(2);
doubleFormat.setMinimumFractionDigits(2);

NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);

NumberFormat taxFormat = NumberFormat.getPercentInstance(locale);

taxFormat.setMinimumFractionDigits(3);

WindowState windowState = null;
PortletMode portletMode = null;

if (renderRequest != null) {
windowState = renderRequest.getWindowState();
portletMode = renderRequest.getPortletMode();
}
else if (resourceRequest != null) {
windowState = resourceRequest.getWindowState();
portletMode = resourceRequest.getPortletMode();
}

String currentURL = PortalUtil.getCurrentURL(request);
%>
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
I changed my environment a bit to make development a bit easier. I do not use the plugin environment.

I basically use a standard java web application with the build scripts from the plugin environment and a few more files. So I can take advantage of the java web development tools of my development environment (which happens to be eclipse).

I hear that the PortalPack for Netbeans makes developing portlets pretty easy too. There is even a special toolset for servicebuilder in it.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
They would have to be altered at least a little bit (depending on how you are going to group them). Each portlet would have to be stand alone.

At a minimum:
So you would have to make sure that each portlet has it's own initialization (basically replacing the init.jsp's role or duplicate the same init.jsp in each portlet). You would have to remove the references to the pages that you are splitting into new portlet. So if you wanted the checkout to be a separate portlet then you wouldn't want the other portlets to try to load the checkout function inside of it.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
I keep like portlets in the same war file. So I like to organization the portlets in their own directory. I think I got that format from Liferay's source code.

html/portlet/cart
html/portlet/browse
etc.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
After seeing the error messages it appears that some of the imports are missing. The first error that I saw is an error about WebKeys.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
Your java classes need to be in the docroot\WEB-INF\src directory (if you are using the plugin environment), while your jsp files should be somewhere under docroot (Not under the WEB-INF directory).
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
<%@ page import="com.liferay.portal.util.WebKeys" %>
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
How comfortable are you with writing java applications.

Do you like using an ide or are you a text source code editor?

And which development environment are you using.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
No. You just need to make sure that the class is imported into you development environment.

Are you using Eclipse, Netbeans, or some other type of development environment.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
You add a reference to the jar files in Liferay. In the plugin sdk there is a file called app.server.username.properties. That files tells the development environment where all of the liferay files are. So you don't have to import the classes into your project.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
app.server.tomcat.version=6.0.18
app.server.tomcat.dir=C:\\Documents and Settings/Owner/Desktop/Myiah/liferay-portal-5.2.3/tomcat-6.0.18

should be
app.server.tomcat.version=6.0.18
app.server.tomcat.dir=C:/Documents and Settings/Owner/Desktop/Myiah/liferay-portal-5.2.3/tomcat-6.0.18

It tells the ant scripts where to find your install of Liferay. So it can use the available libraries when you are compiling your source.

If you are using eclipse I could send you a template that I created based on the Eclipse Web Tools Project. It may make doing your development easier.

The only issue is that it is basically replacing the plugin sdk but putting all of the plugin sdk resources in a since Web Project.

I can also migrate the existing Shopping cart resources from Liferay into the template that I send you so you will have someplace to start.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
What where the portlets that you wanted to split the shopping portlet into?

Catalog
Checkout
?
Nitin Sharma, modificado hace 14 años.

RE: Shopping portlet

New Member Mensajes: 7 Fecha de incorporación: 26/03/09 Mensajes recientes
Hello Albert,

after splitting into many portlets, how did you communicated between shopping portlets.

Thanks
Nitin Sharma, modificado hace 14 años.

RE: Shopping portlet

New Member Mensajes: 7 Fecha de incorporación: 26/03/09 Mensajes recientes
Hello Albert,

Did you use ext enviornment to break shopping portlet in multiple portlets?
Did you create your own action classes or used the exsisiting ones for the portlets?

I am little confused in how exsisting shopping portlet should be divided in terms of enviornment.Since this is an exsisting portlet, it should be done in ext env.


thanks

Nitin
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
I initially split them using the extension environment but I currently have them all deployed in a java web application (outside of the plugin environment and extension environment). Since they are in the same war file they can communicate just fine.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Shopping portlet

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
Initially all I did was separate the jsp files into separate portlets. Then I debugged it to find out that I had initiialization dependencies between the portlets that I had to satisfy. So I started adding them one piece at a time.