insert cart total as reward points in opencart












1















im trying to get the cart total from the checkout and once the users confirms the order, to add the total amount as reward points...



for an example lets say if someone purchases goods worth 245$ i want to add the 245 as reward points.. Can someone please let me know the best way to do this?



I noted that in opencart the reward points are saved in oc_customer_reward but i couldnt find the sql in the order model related to that.



Any help will be appreciated










share|improve this question























  • Are you looking to add reward points into oc_customer_reward Table?

    – Harish ST
    Nov 22 '18 at 6:13











  • At present, the reward points assigned to the products are used when you order something. Are you looking to replace this?

    – Harish ST
    Nov 22 '18 at 6:19






  • 1





    Edit product > Reward Points (TAB). Add the price of the product as points.

    – kanenas
    Nov 23 '18 at 9:32


















1















im trying to get the cart total from the checkout and once the users confirms the order, to add the total amount as reward points...



for an example lets say if someone purchases goods worth 245$ i want to add the 245 as reward points.. Can someone please let me know the best way to do this?



I noted that in opencart the reward points are saved in oc_customer_reward but i couldnt find the sql in the order model related to that.



Any help will be appreciated










share|improve this question























  • Are you looking to add reward points into oc_customer_reward Table?

    – Harish ST
    Nov 22 '18 at 6:13











  • At present, the reward points assigned to the products are used when you order something. Are you looking to replace this?

    – Harish ST
    Nov 22 '18 at 6:19






  • 1





    Edit product > Reward Points (TAB). Add the price of the product as points.

    – kanenas
    Nov 23 '18 at 9:32
















1












1








1








im trying to get the cart total from the checkout and once the users confirms the order, to add the total amount as reward points...



for an example lets say if someone purchases goods worth 245$ i want to add the 245 as reward points.. Can someone please let me know the best way to do this?



I noted that in opencart the reward points are saved in oc_customer_reward but i couldnt find the sql in the order model related to that.



Any help will be appreciated










share|improve this question














im trying to get the cart total from the checkout and once the users confirms the order, to add the total amount as reward points...



for an example lets say if someone purchases goods worth 245$ i want to add the 245 as reward points.. Can someone please let me know the best way to do this?



I noted that in opencart the reward points are saved in oc_customer_reward but i couldnt find the sql in the order model related to that.



Any help will be appreciated







opencart opencart2.x






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 17:32









LiveEnLiveEn

1,41693777




1,41693777













  • Are you looking to add reward points into oc_customer_reward Table?

    – Harish ST
    Nov 22 '18 at 6:13











  • At present, the reward points assigned to the products are used when you order something. Are you looking to replace this?

    – Harish ST
    Nov 22 '18 at 6:19






  • 1





    Edit product > Reward Points (TAB). Add the price of the product as points.

    – kanenas
    Nov 23 '18 at 9:32





















  • Are you looking to add reward points into oc_customer_reward Table?

    – Harish ST
    Nov 22 '18 at 6:13











  • At present, the reward points assigned to the products are used when you order something. Are you looking to replace this?

    – Harish ST
    Nov 22 '18 at 6:19






  • 1





    Edit product > Reward Points (TAB). Add the price of the product as points.

    – kanenas
    Nov 23 '18 at 9:32



















Are you looking to add reward points into oc_customer_reward Table?

– Harish ST
Nov 22 '18 at 6:13





Are you looking to add reward points into oc_customer_reward Table?

– Harish ST
Nov 22 '18 at 6:13













At present, the reward points assigned to the products are used when you order something. Are you looking to replace this?

– Harish ST
Nov 22 '18 at 6:19





At present, the reward points assigned to the products are used when you order something. Are you looking to replace this?

– Harish ST
Nov 22 '18 at 6:19




1




1





Edit product > Reward Points (TAB). Add the price of the product as points.

– kanenas
Nov 23 '18 at 9:32







Edit product > Reward Points (TAB). Add the price of the product as points.

– kanenas
Nov 23 '18 at 9:32














2 Answers
2






active

oldest

votes


















2














There are lots of ways you could approach this - the easiest I can think of is in system/library/cart/cart.php (path depends on your version) change:



'reward'          => $reward * $cart['quantity'],


to



'reward'          => ($price + $option_price) * $cart['quantity'],


This way the rewards are passed to any other functions that rely on the cart data - including third party checkout extensions.






share|improve this answer
























  • I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

    – Nancy Savescu
    Nov 27 '18 at 3:13





















0














You can try the following edit for automatic insertion of points when adding products.



admin/view/template/common/header.tpl
find:



</head>


add before:



<script type="text/javascript">
$(document).ready(function(){

var product_reward = $("input[id=product_reward]");
$("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").keyup(function(){
var autoPoints = $("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").val();

autoPoints = autoPoints * 0.05;

product_reward.val(autoPoints);
});
});
</script>





share|improve this answer
























  • No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

    – Nancy Savescu
    Nov 27 '18 at 3:16













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417673%2finsert-cart-total-as-reward-points-in-opencart%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














There are lots of ways you could approach this - the easiest I can think of is in system/library/cart/cart.php (path depends on your version) change:



'reward'          => $reward * $cart['quantity'],


to



'reward'          => ($price + $option_price) * $cart['quantity'],


This way the rewards are passed to any other functions that rely on the cart data - including third party checkout extensions.






share|improve this answer
























  • I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

    – Nancy Savescu
    Nov 27 '18 at 3:13


















2














There are lots of ways you could approach this - the easiest I can think of is in system/library/cart/cart.php (path depends on your version) change:



'reward'          => $reward * $cart['quantity'],


to



'reward'          => ($price + $option_price) * $cart['quantity'],


This way the rewards are passed to any other functions that rely on the cart data - including third party checkout extensions.






share|improve this answer
























  • I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

    – Nancy Savescu
    Nov 27 '18 at 3:13
















2












2








2







There are lots of ways you could approach this - the easiest I can think of is in system/library/cart/cart.php (path depends on your version) change:



'reward'          => $reward * $cart['quantity'],


to



'reward'          => ($price + $option_price) * $cart['quantity'],


This way the rewards are passed to any other functions that rely on the cart data - including third party checkout extensions.






share|improve this answer













There are lots of ways you could approach this - the easiest I can think of is in system/library/cart/cart.php (path depends on your version) change:



'reward'          => $reward * $cart['quantity'],


to



'reward'          => ($price + $option_price) * $cart['quantity'],


This way the rewards are passed to any other functions that rely on the cart data - including third party checkout extensions.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 25 '18 at 18:42









billynoahbillynoah

11k64468




11k64468













  • I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

    – Nancy Savescu
    Nov 27 '18 at 3:13





















  • I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

    – Nancy Savescu
    Nov 27 '18 at 3:13



















I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

– Nancy Savescu
Nov 27 '18 at 3:13







I think this should be the accepted answer. I've used system/library/cart/cart.php to adjust for many things such as custom pricing and including the rewards in this manner

– Nancy Savescu
Nov 27 '18 at 3:13















0














You can try the following edit for automatic insertion of points when adding products.



admin/view/template/common/header.tpl
find:



</head>


add before:



<script type="text/javascript">
$(document).ready(function(){

var product_reward = $("input[id=product_reward]");
$("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").keyup(function(){
var autoPoints = $("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").val();

autoPoints = autoPoints * 0.05;

product_reward.val(autoPoints);
});
});
</script>





share|improve this answer
























  • No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

    – Nancy Savescu
    Nov 27 '18 at 3:16


















0














You can try the following edit for automatic insertion of points when adding products.



admin/view/template/common/header.tpl
find:



</head>


add before:



<script type="text/javascript">
$(document).ready(function(){

var product_reward = $("input[id=product_reward]");
$("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").keyup(function(){
var autoPoints = $("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").val();

autoPoints = autoPoints * 0.05;

product_reward.val(autoPoints);
});
});
</script>





share|improve this answer
























  • No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

    – Nancy Savescu
    Nov 27 '18 at 3:16
















0












0








0







You can try the following edit for automatic insertion of points when adding products.



admin/view/template/common/header.tpl
find:



</head>


add before:



<script type="text/javascript">
$(document).ready(function(){

var product_reward = $("input[id=product_reward]");
$("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").keyup(function(){
var autoPoints = $("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").val();

autoPoints = autoPoints * 0.05;

product_reward.val(autoPoints);
});
});
</script>





share|improve this answer













You can try the following edit for automatic insertion of points when adding products.



admin/view/template/common/header.tpl
find:



</head>


add before:



<script type="text/javascript">
$(document).ready(function(){

var product_reward = $("input[id=product_reward]");
$("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").keyup(function(){
var autoPoints = $("input[name^='price'],input[name='name'],input[name^='information_description'],input[name^='category_description']").val();

autoPoints = autoPoints * 0.05;

product_reward.val(autoPoints);
});
});
</script>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 25 '18 at 18:13









OğuzOğuz

12




12













  • No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

    – Nancy Savescu
    Nov 27 '18 at 3:16





















  • No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

    – Nancy Savescu
    Nov 27 '18 at 3:16



















No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

– Nancy Savescu
Nov 27 '18 at 3:16







No point in adding yet another script when it can easily be accomplished directly in php via system/library/cart/cart.php as per @billynoah answer. It's the best way to do it.

– Nancy Savescu
Nov 27 '18 at 3:16




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417673%2finsert-cart-total-as-reward-points-in-opencart%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?