- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2017 01:59 PM
We are on Helsinki Patch 11 and have the cart showing on our service portal. When a user fills out the fields on a cat item and adds to cart, the ability to change some of those fields and add again isn't working. I saw a mention in another post - Add to Cart functionality for Service Portal - where you can disable this, but I don't see how. Any help? This featured is used pretty regularly by our users.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2017 02:38 PM
Hi Blair,
Now that we know it the same code and disabled in all.. I thought let me figure this and found it
Some steps
- Clone the sc catalog item widget (else it is read only)
- Attache the cloned widget the the Service catalog page
- Look for the ng-disabled="submitted" on the line containing Add to cart and DELETE the ng-disabled="submitted"
- You also need to make changes to the client script highlighted below (EDIT Updated code to fix submit greyed out after add)
I didnt test for other side effects but add to cart works and does not get disabled after adding
Let us know how it goes. breinhart
Mine...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2017 10:40 AM
Hi Blair,
Basically, we can hide the add to cart button based on if submitted is true or false. Change the below HTML :
<button tabindex="0" ng-if="c.showAddCartBtn()" name="submit" ng-click="triggerAddToCart()" class="btn btn-default">${Add to Cart}</button>
to
<button tabindex="0" ng-if="!submitted && c.showAddCartBtn()" name="submit" ng-click="triggerAddToCart()" class="btn btn-default">${Add to Cart}</button>
If you wanted to disable:
<button tabindex="0" ng-if="c.showAddCartBtn()" name="submit" ng-disabled="submitted" ng-click="triggerAddToCart()" class="btn btn-default">${Add to Cart}</button>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2017 07:28 AM
Ravindran,
Perfect! Thank you again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2017 07:49 AM
Hi Ravindran,
Can the submit button be hidden once 'add to cart' is clicked? I tried adding ng-disabled to this line with no luck:
<button ng-if = "!addToCart" name="submit" ng-disabled="submitted" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>
<button ng-if="!submitted && c.showAddCartBtn()" name="submit" ng-disabled="addToCart" ng-click="triggerAddToCart()" class="btn btn-default">${Add to Cart}</button>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2017 12:48 PM
Hi Blair,
You may have to edit the html:
<button ng-if="!added && c.showOrderNowButton()" tabindex="0" name="submit" ng-disabled="submitted" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>
And update client controller:
function addToCart() {
postCatalogFormRequest(true).success(function(response) {
$rootScope.$broadcast("$sp.service_catalog.cart.add_item");
$rootScope.$broadcast("$sp.service_catalog.cart.update");
//spUtil.addInfoMessage("Added item to shopping cart");
$scope.submitting = false;
c.status = "Added item to shopping cart";
$scope.added = true; //add this line
});
}
But reloading a page will reset the status and the submit button will be enabled.
More work might be needed if you want the page reload to consider items in cart:
* Check quantity > 1 and set the $scope.added to true (this seems tricky)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2017 01:06 PM
Hi Ravindran,
That seemed to have worked. I want the submit to be there if they reload the form or open a new form. They have the option of either/or. If they select submit, then add to cart is gone, and if they add to cart then submit is gone. Will do more testing.