How to extend existing pages, such as Customer or Shopping Cart, through plugins? - nopcommerce

I've read everywhere that it's better to write new plugin than touch the core code. The problem is that I've not been able to find documentation where it's explain clearly how to modify pages from the plugin.
The way I understood it, to display partial pages from the plugin, one needs to tells where to display them by return using this method:
public IList<string> GetWidgetZones()
But if you return more than one zone, the widget will be displayed in multiple zones. What if I want to display bit of information on different zones?
To start off, I'd like to extend the the Customer page. The menu on that page has 7 items: customer info, addresses, orders, downloadable products, back in stock subscriptions, reward points, and change password.
I'd like to add 2 more items: personal info and connections. When personal info is clicked, the customer will able to add extra info, such as his/her photo. When the connections is clicked, user would be able to see what other have been doing.
Can someone point me to the documentation that explain how one can extend existing pages, such as Customer and Shopping Cart, without touching the core code.
Thanks for helping

I have read people saying do modifications as much as using plugin. But in practical i do find modifying core logic is one good way to find elegant and less complex way of customizing to our need.
Because, plugins only provides up to a certain limit of modification. In your case, widgets can be extended. But i don't think customer detail page can be extended using plugins. based on your requirements, you may need to add additional columns/attributes for customers. Yes, you can add/remove columns while installing/removing plugins. But in practical, any user in admin can uninstall a pluign. Think if this happens in PROD. Also you have not elaborated about connections.
I have done 250+ custom modifications (to suite our need) on core nopcommerce for my organization over the period of 2.5years. I started with nop 2.65 then moved to 2.80 and then moved to 3.20. Its bit complex to upgrade nop commerce versions on top of our custom modifications. But i can be done, if you are organized from day one.
Here are few rules i follow,
Keep a detailed custom modification list in excel.
Always update code in such as way that new feature can be managed from admin. Example: if you add a new menu in the header, just make sure it can be shown/hidden under admin settings. And this helps to contribute back to nop commerce if possible.
Use a good database Diff tool.
Use version control.
So when a new version of nop is released, i quickly compare my excel with release notes. for migration details see here

Related

Custom code in Wordpress: what are the programming limitations?

I have a website (www.easterisland.travel) that I'm considering converting into a Wordpress site. Why? Basically for the following reasons:
1: To use a CMS, so that I can teach others to further add content to the website without having programming knowledge. I would built the advanced pages myself though, and the pages that others would manage would be simple information pages.
2: Access to all of these great plugins, for example the "similar pages" plugin at the bottom of each page (which I haven't found as a independent solution for raw webpages), which is just fantastic to keep people reading.
At my site I have lots of custom stuff like booking systems that I've created. There's an AngularJS shopping cart (www.easterisland.travel/tours/), instant online booking and payment (using PayPal's Express Checkout) etc. There's a page for cruise ship shore excursions (www.easterisland.travel/cruise-ship/) that's automatically generated from database data, and I've created a system where I can add cruise ships and shore excursions (adding correct itinerary, price, info etc). Passengers can also log in and communicate to other future fellow travelers within the same group, and get organized for meeting up on the tour day. I have many more plans to go as well, for example showing hotel info, displaying TripAdvisor data (using TripAdvisor API) etc.
The million dollar questions are:
1) Can all of this be achieved in a Wordpress site? Can I add all of these systems using this platform? What are the limitations?
2) Would it make sense to change to Wordpress?
3) What implementation should be used? I don't want my code to be removed or altered when Wordpress is automatically updated.
Thank you!
Wordpress doesn't have any limitations, you can extend its default functionality if it can't accomplish what you need with either plugins or custom code. and having a framework is always better than building from scratch in many ways.
HOWEVER, wordpress was originally design as blogging platform, and if you plan on extending its simple functionality you should take some time to understand how it works to properly integrate your custom needs or things could get ugly,
If you know how to interact with the database, you can easily do what you want, there are built-in functions you can use according to your needs for database interactions or just create your own if it doesn't fit well very much.
just a quick overview with wordpress database.
wp_posts - where sites main front-end data are stored, like posts, pages,
wp_postmeta - storage for additional data that are stored on wp_posts
wp_comments - storage for user interaction data for wp_posts like comments, I've also used these before to store user/admin messages.
wp_terms - use for dividing/categorizing wp_posts data, like categories and tags,
wp_options - use for back-end storage data and configuration.
You'd need to check out these functions as you're probably will encounter them in the future
https://codex.wordpress.org/Function_Reference/add_post_meta
https://developer.wordpress.org/reference/functions/get_post_meta/
https://codex.wordpress.org/Function_Reference/update_post_meta
https://codex.wordpress.org/Function_Reference/register_post_type
https://codex.wordpress.org/Function_Reference/register_taxonomy
https://codex.wordpress.org/Class_Reference/WP_Query
If you also need database interaction, check out https://codex.wordpress.org/Class_Reference/wpdb
and for front-end implementation, check this out https://developer.wordpress.org/themes/basics/template-hierarchy/, though I never used any other wordpress theme except Genesis Framework for these past 5 years as I never had to mess too much with HTML codes and almost everything can be customize using actions & filters. I advise you to use Theme Framework (and remember to always use CHILD THEME to be safe from Main Theme upgrade)
You might also want to check -> https://github.com/WebDevStudios/CMB2 (I prefer to use this than Advance Custom Fields plugins.)
Booking system in wordpress is a bit complex, I've successfully use gravity form as booking system with AngularJS + Ajax, but never tried a custom one from scratch and don't have a chance to use booking plugin as never encountered a cleint that wants a simple booking system.
Just to answer your question.
Yes, It can, for comparison, take a look at woocommerce plugin functionality and features, I believe thats more complex than what you need.
It would make sense to convert a site built from scratch to any CMS (wordpress is an option), the CMS is up to you, though its better to use the one that you know more for easier integration and customization.
You can use your child theme "functions.php" for extending your custom functionality, like create a folder in your theme for all your custom code and include/require it on your child theme functions.php or better create your own plugin to properly integrate them, you can divide the functionality in plugins, like plugin for booking system and plugin for payment functionality. check this out https://github.com/hlashbrooke/WordPress-Plugin-Template
I hope this would give you an idea.
Yes you can do all that. You will need someone with knowledge in wordpress themes and plugins but it is possible. The beauty of wordpress is, that you can write "bare" php code, and the small amount of functions to interact with wordpress are well documented.
Wordpress itself, is structured "simple" (compared to fancy tools like magento for example). So all it manages, are posts / pages / ... which, more or less derive from the same database object. You can add functionality to those things (for example, make posts cruise ships and other posts to shore excursions) or you can add your own database structure on top.
The theme system is bare php code, so you dont have to crawl through a thousand lines of xml codes to adjust little things.
Wordpress power derives from its simplicity of the "core wordpress" and the feature volume based on all those plugins. I believe alot of people would say, that you should go for a custom solution (based on symfony for example), or a CMS that already comes with more of your desired functions (like magento which has the checkout / paypal included), but I (as a wordpress fan) would see no problem to take wordpress.
I have never failed to find a plug-in to do what I needed! I manage three WordPress sites - although none of them is commercial. (Yacht Club, Cycling Club and Political Party EDA).
There is a plug in that allows PHP on any WordPress page, but it means that the Editors all have to write using the text (HTML) view rather than Visual tab. I found that useful for some of my pages - and I'm the only "Editor."
There's also a plug-in that allows you to code PHP in Widget. That doesn't have the above disadvantage.

Event quotation plugin for Magento OR Wordpress

Im starting to develop a new website for a client, it is an events hire site for a sound and lighting company.
What they want is a system where they have all their products listed with their hire prices and an add to quote button.
They would like the users to be able to select different options with each products e.g. a configurable product in Magento.
After the user has selected all the products they want in their event quote, they want there to be a button which says "go to my quote" or something along those lines.
At this page the user can review their quote, add the dates and times of the event and add any additional notes.
This all then gets sent to the backend of whatever system we use and can be dealt with from there.
My question: What platform would be better for this, Wordpress OR Magento?
And do you know of any plugins that support all the options i displayed above, for either platform (preferable free)??
Thanks very much
I guess this question is outdated, but in case someone has the same question: Magento in combination with Cart2Quote should do the trick.
Wordpress: One way is to use Wordpress, WooCommerce in combination with something like 'WooCommerce Request a Quote'.
The downside is, most WooCommerce quote modules are more advanced form modules and just provide in some basic functionality. (Which is perfect if that is exactly what you need)
Magento: One other way is to use Magento and Cart2Quote.
The downside is, its way more expensive.
I personally would use Magento, because in my opinion it is by far a more powerful store solution.
However you find yourself more often in a situation that you need a (external) developer and those are expensive. (The upside is that Magento developers are in most cases great developers, you get what you pay for.)
If your goal is to keep the cost as low as possible, than I would go for the Wordpress solution.

Intranet with custom Workflows in OpenAtrium/Drupal

I've been reading about building an intranet site with different frameworks and I've found Open Atrium to be a great alternative since it's naturally oriented to that use.
I'd love to add some custom workflows associated with personnel management, for example, each team member gets a reminder every Friday to fill out a form with the hours of the week dedicated to each project. Once submitted, the role 'administrator' gets notification of all the forms received and of those not received, the details of each one and the sum of hours per
project. Any insight on how to proceed with this implementation would be greatly appreciated.
I've searched but haven't found a module that has this kind of workflow. How would this be implemented with cck, views or fields?
I would use the Rules module to create the first part: emailing users to remind them to fill in their forms. The rules module has a 'Send mail to all users of a role' action which you can use.
I would use the Views module to create a new view of the filled in forms (which I assume will just be nodes of a certain content type) and make that view accessible only to the administrator in the view's 'Access' section. Views are quite powerful, and you'll probably be able to do most all of what you require with them, but it's hard to be more specific without knowing which version of Drupal you're using and any more details about the problem (such as, will this form users are filling out really be just a node or a webform?). As an example of a views feature: if you go to add a field to your view, you should be able to see a ' Global: Math expression' field, where you can do things like add previous fields together, etc.
On the other hand, if you use the Webform module to build the form users have to fill out, that can send an email automatically each time it's submitted and the responses can be downloaded into an excel file by the administrator to manipulate further.
Hope some of those ideas help!

How do I add order information from Google Checkout into my database?

I have implemented Google Checkout sandbox for testing buy button which successfully allows user to place their orders. I want to add order of Google Checkout sandbox to my database by using asp.net.
Can anyone tell me how can I implement this scenario?
There are multiple interfaces to Google Checkout . By far the easiest is a buy now button, which is what it sounds like you've implemented. Now the limitation with that method is that it places one item into a cart at Google and that's the end of the interaction. So you need to process the order in the Merchant center. Nice and simple for small sites processing few orders. But doesn't sound like what you want. At the other end of the spectrum, you can do a custom cart using the html or xml interfaces. Using the xml interface, you have complete control of the order. Google will then do call backs on complete order to post the cart back to your site. Taken to the extreme, you can automate pretty much anything that could be done in the merchant center: canceling orders, issuing refunds, etc.
It's all a question of trading off integration effort with control. They offer a number of different integration patterns. There's a nice comparison on in the developer docs. But with the buy now buttons, I don't believe that anything ever comes back to your system, and it sounds like you want the order details back on your system/site. You may also want to take a look at Ways to integrate with Google Checkout and pick the integration pattern that makes the most sense for you.
I don't have ASP.Net code to hand you, but I'm sure it's doable and there are examples in the developer docs.
See this site for Checkout Client Libraries & Sample Code (including .NET and Classic ASP):
http://code.google.com/apis/checkout/samplecode.html

Any downside saving shopping cart in Profile? Profile Migration?

I'm doing some research for my project where I'm gone have a shopping cart. I been reading some and one way that shopping cart seem to be handled in mvc is to save it to the Profile and later on save it in the db after order is complete, and [Serializable] on the class.
My question is do you see any downside doing it like this with the profile?
EDIT
I think I found a downside saving the cart to profile and that is the migration from anonymous to authenticated user. I'm currently working on Web Application Project so The migration solutions I found don't work (in the global with Profile Common). I found some useful information recently but I want to ask here one thing tho. The info I found is I can get and set the properties in the profile, but the migration part is still unsolved. Anybody got any tips on this or solution that can point me in the right direction?
This is the classic it depends.
Size is the biggest draw back I can see.
It depends on the size of your object. You could have a very large object when really all you need a list of ProductIds that is in the user cart. Could be allot of bytes compared just a few.
If I was doing something like this I would just save a list of the Products in the shopping cart. There might be more information needed (like qty), but I would try to save the bare minimum to keep the read/write as small as possible.
When you Seialize a class it if you use Xml you get an element for each property. Binary is a little more compact (which is what I would choose).
An additional downside is session length. If session times out, how do you want to handle the cart?

Resources