Skip to main content

GSoC’17 Coding period | Week #8 | UC Wishlist



The eighth week of Google Summer of Code 2017 has come to a close, bringing forth the onset of the Second Evaluation Period. Presently, I've been working on porting the 'Uc Wishlist' module to Drupal 8, under the guidance of my mentor, Naveen Valecha. The conceptualization and understanding developed during the first phase of coding have been of immense help and has provided notable assistance for the completion of the assigned ports.

This month, concerning this week in particular saw the completion of a significant amount of work concerning the ports assigned for the Second phase of the coding regime. The work done this week can be briefly described as follows:
  • Fixed the 'Add to wishlist/Remove from wishlist' submit handler for the second port. Previously, on clicking on the add to wishlist button, the screen showed an error page, and the product couldn't get registered. However, the error has been fixed and products can now be added/removed from the wishlist, with the drupal_set_message function displaying the addition/removal of the ports.
The earlier week I had summarised the implementation for the third port, i.e, porting ‘View/Update wishlist’ functionality. So, the work done this week for the completion of the third port can be summarised below:
  • The first thing I did was to define an interface my UcWishlist entity type class can implement and that extends the default ContentEntityInterface alongwith EntityOwnerInterface. So inside of the module's src/Entity folder, create a file called UcWishlistInterface.php.
  • Next,  I focused on the crux of defining my own Content Entity class and created a folder inside the src/ directory called Entity, and within it, a file called UcWishlist.php.
  • What we have here is a simple class defining the entity properties required. This class    extends the default ContentEntityBase class and implements the UcWishlistinterface. Using annotations, we are basically telling Drupal about our UcWIshlist entity type. The @ContentEntityType tells Drupal that this is a Content Entity type. Within its definition, we have an array-like structure describing the wish list contents.
  • The next thing we need to do is create the form we referenced in the annotations above: for adding, editing and deleting wish list entities. The cool thing is that the form for adding can be reused for editing as well. For that we create a form by the name WishlistViewForm.php in the src/Form directory.
  • As I declared when defining the content entity class, I created a class file responsible for building the overview page of the entities. So straight in the src/ folder of the module I created a UcWishlistListBuilder.php class file extending EntityListBuilder.
When no products are added, and a user clicks on the 'Wishlist' menu link, the user is appropriately directed to the page controlled by the myWishlist Controller class and displays the correct message through drupal_set_message. This part works as planned.

However, when a product is added to the wishlist and then the wishlist menu link is accessed, it is directed to an error page. Also when /admin/store/customers/wishlists route is accessed the current wishlist status shows Expired by default. This might also lead to the problem. This is the only problem that's occurring as of now. Rest everything seems to work as planned and the third port is done.

D8 visuals for the completed port, ‘View/Update wishlist’:



 
Regarding the fourth port, i.e., ‘Search Wishlist’ functionality, the implementation is to be carried out in the following manner for its completion:
  • The WishlistSearchForm for creating the search wishlist textfield to be accessed through Search API rather than Drupal Core Search, which includes the following fields:
    • Search submit button: To execute the required search.
    • Search results list: Displaying the expected search results.
    • Search text box (textbox): If there are keywords, check for the user, wish list title, or address matches.
  • After installing the Search API, an index object can be created followed by inserting the fields to the index which have to be searched.
  • This way we have all the required data inside the index object and then execute the search method by triggering index->query form in the submit form section.
Winding up, these were the objectives and concepts learned during the eighth week of coding phase in GSoC’17. Hope to learn many more new concepts in the coming weeks for the successful completion of the port.

Cheers!

Comments

Popular posts from this blog

GSoC’17 Coding period | Week #5 | Drupal

The second phase of the Coding Phase officially kicked off the previous week on June 30th, 16:00, marking the conclusion of the First Evaluation period for Google Summer of Code 2017. On the personal front, I would like to state that I progressed successfully through the evaluations by completing the two designated ports for my project ‘Porting UC Wish list to Drupal 8’ , under the able guidance of my mentor, Naveen Valecha . I have also maintained a detailed info for the work done as part of the first phase evaluations in a previous blogpost . The previous week, based on the mentor’s review of the earlier ports done, I had also fixed the coding standards and made some changes to the code, as suggested by him. Meanwhile, based on a comprehensive analysis for the above mentioned ports, the work done briefly the earlier week can be stated as: 'View wishlist' option visuals in D8: 'Email wishlist' option visuals: As of now, I...

GSoC’17 Coding period | Week #7 | UC Wishlist

With the last week of the second phase of the Google Summer of Code 2017 underway, the seventh week has come to a close. The previous week saw the completion of the third port for the second regime, i.e., porting ‘View/Update wishlist’ . The earlier week I had summarised the implementation for the third port, i.e, porting ‘View/Update wishlist’ functionality. So, the work done the previous week for the implementation of the mentioned third port can be summarised below: The first thing I did was to define an interface my UcWishlist entity type class can implement and that extends the default ContentEntityInterface alongwith EntityOwnerInterface . So inside of the module's src/Entity folder, create a file called UcWishlistInterface.php . Next,  I focused on the crux of defining my own Content Entity class and created a folder inside the src/ directory called Entity , and within it, a file called UcWishlist.php . What we have here is a...

Community Bonding with Drupal | GSoC 2017

As mentioned previously, this year I got selected for GSoC under Drupal for the project ‘Porting UC wish list to Drupal 8’ . This blogpost would concisely pivot around the Community Bonding period with Drupal for GSoC’17, thereby focusing on it’s importance and objectives achieved during this phase. This year, the accepted GSoC proposals/projects were announced on April 3, 21:00 IST. The selected students are entitled to participate in the Community Bonding period till May 29th. The Community Bonding period, essentially, is the time for the selected students to socially engage with the fellow developers & learn extensively about their organisation’s functionalities, in other words, have a comprehensive understanding of an organisation’s codebase, codes of conduct, releases etc, rather than jumping straight into coding. Moreover, during this term students have the opportunity of interacting with their respective mentors, plan correspondingly about their proj...