GSoC’17 Coding period | Week #3 | Drupal

week3

 

With the conclusion of the third week of Google Summer of Code 2017, the initial phase of the coding period is coming to a closure. The conceptualization developed during the previous weeks have been of immense help, and has been of notable assistance for the completion of the ports for the first phase.

The previous week, as I had stated in my earlier blogpost, I had to port the following sub-modules regarding the UC Wish list framework:

  • Add Administrator wish list settings: This sub-module, to be brief had two functionalities to be considered for a successful port:

    • Configure wish list settings: These settings would provide the administrator with a substantial authority over any wish list in general by providing definite options to modify a wish list and accessed through the route /admin/store/configuration/wishlist.

    • Manage user wish lists: This option enables the administrator to view/monitor and configure the user wish lists and also delete any wish list on getting expired or on not being required. Accessed through the route /admin/store/customers/wishlist.

  • Include ‘Add to cart’ and ‘Add to wishlist’ buttons: This port would allow a user to add a preferred item to the shopping cart and/or any wish list in general. This feature would also allow items in the cart to be added to a wish list.

As I had mentioned in the previous blogpost, till week 2 I had almost completed the first port by configuring the administrator wish list settings and completing a substantial portion of managing user wish lists. With the conclusion of week 3, I have completed the port of the administrator wish list settings. Moreover, I have also included the ‘Add to wish list’ feature as part of the second port.

Thereby I would briefly like to state the steps taken to port the above functionalities:

  • Manage user wish lists:

    • Implementing hook_menu by defining Routes, which are basically are the mappings between URL paths and their corresponding page and access callbacks, stored in the uc_wishlist.routing.yml file by the route name uc_wishlist.admin_wishlist

    • Creating database queries to query the user and related wish list information and retrieving them.

    • Creating a corresponding Controller class by implementing a function to retrieve a paged list of wish lists by querying the related database created in the /src/Controller directory.

    • Providing the required menu link associated with the port in YAML format in the uc_wishlist.links.menu.yml file.

wishdr
  • Include ‘Add to cart’ and ‘Add to wishlist’ buttons:

    • Considering adding items to cart, the function uc_cart_add_item() is be used. This button would be accessible on the user’s wish list only if product is not out of stock. To check that we would use uc_stock module uc_product_exist.

    • For adding items to a wish list, we would use the Hook function uc_wishlist_add_to_wishlist_submit and delivery to orders will add item to wish list and redirect the page.

    • Implement hook_form_validation to add validation to the uc_cart_view_form.

addwish

As mentioned above, I was able to port the ‘Add administrator wish list settings’ and include ‘Add to wishlist’ & ‘Add to cart’ features as a part of the previous week’s regime. The associated bug fixes would be fixed as per schedule. The next week would include the final portion of the first phase of the coding period, wherein I intend to implement viewing/updating the user wish list after adding products to a specific wish list, by implementing Views Integration through the Views module. The code associated with the port can be found here.

Winding up, these were the objectives and concepts learned during the third 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!