How to edit add to cart button in service portal?

Rinty
Giga Contributor

In service portal, when I click on "add to cart" button, it gives me two option. one is "Catalog Home" and another is "View Cart". I want to take off "Catalog Home" button and put another button in there called "Continue shopping" which will redirect user to the sc_cat_item_guide. Can someone please help me with that?

Clear instruction with steps please. I am not familiar with service now.

Thank you!

1 ACCEPTED SOLUTION

Rinty
Giga Contributor

Oleg,

I have done this and still it's not mapping to the sc_cat_item_guide. Can you please help me with it? 

 


spModal.open({
      message: i18n.getMessage('Items have been added successfully'),
      size: 'sm',
      backdrop: 'static',
      keyboard: false,
      noDismiss: true,
      buttons: [
         {label: i18n.getMessage('Continue Shopping'), cancel:true},
         {label: i18n.getMessage('View Cart'), primary:true}
       ]
           }).then(function() {
               $location.search("id=sc_cart");
           }, function() {
           $location.search("id=sc_cat_item_guide");
              })

           });
   }

View solution in original post

10 REPLIES 10

Rinty
Giga Contributor

Oleg,

Thank you very much for explaining each step. It worked. Thanks a lot. I need one more help, I need to add "Continue Shopping' button on the same place where "Catalog Home" used to be. And "continue shopping" button will take them back to order guide page. Can you please help me with how to get that job done please? 

Thank you,

Rinty

If I correctly understand your problem then you can change the callback function

function() {
	$location.search("id=sc_cart");
}

to

function (result) {
    if (result.label === i18n.getMessage('Continue Shopping')) {
        // do something if neeed
    } else {
        $location.search("id=sc_cart");
    }
}

You can add any custom property to the button and test the property too:

buttons: [
	{ label: i18n.getMessage('Catalog Home'), cancel: true },
	{ label: i18n.getMessage('Catalog Home'), customProperty: "customValue" },
	{ label: i18n.getMessage('View Cart'), primary: true }
]

and to use

function (result) {
    if (result.customProperty === "customValue") {
        // do something if neeed
    } else {
        $location.search("id=sc_cart");
    }
}

Rinty
Giga Contributor

Oleg,

I have done this and still it's not mapping to the sc_cat_item_guide. Can you please help me with it? 

 


spModal.open({
      message: i18n.getMessage('Items have been added successfully'),
      size: 'sm',
      backdrop: 'static',
      keyboard: false,
      noDismiss: true,
      buttons: [
         {label: i18n.getMessage('Continue Shopping'), cancel:true},
         {label: i18n.getMessage('View Cart'), primary:true}
       ]
           }).then(function() {
               $location.search("id=sc_cart");
           }, function() {
           $location.search("id=sc_cat_item_guide");
              })

           });
   }

Sorry, but I'm not sure that I understand the problem correctly. Do you want to display 2 buttons or 3 buttons? To which page you want to redirect?

The statement $location.search("id=sc_cat_item_guide"); isn't work because sc_cat_item_guide required sys_id parameter (try something like id=sc_cat_item_guide&sys_id=d0b15e33d7033100a9ad1e173e24d49e). If you want to redirect to some specific catalog item. I though that id=sc_home or id=sc_category&catalog_id=-1 is the page for "Continue shopping".

Rinty
Giga Contributor

Now I am redirecting to Home page. It worked now. Thanks a lot. 

Thanks,

Rinty