Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZC158: shoppingCart->total_before_discounts is now protected #23

Open
torvista opened this issue Oct 6, 2022 · 7 comments
Open

ZC158: shoppingCart->total_before_discounts is now protected #23

torvista opened this issue Oct 6, 2022 · 7 comments
Assignees
Labels
Milestone

Comments

@torvista
Copy link

torvista commented Oct 6, 2022

fatal error due to this access being blocked:

$this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
} else {
$this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0 /* zen_get_tax_rate($product_check->fields['products_tax_class_id']) *//* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
$this->responseText['preDiscPriceTotal'] = $currencies->display_price($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id']));

@Zen4All
Copy link
Member

Zen4All commented Oct 6, 2022

Thanks, I haven't been very active lately. Slowly picking up ZC again. If you have a solution, feel free to make a PR.

@Zen4All Zen4All added the bug label Oct 6, 2022
@Zen4All Zen4All added this to the 4.0.0 milestone Oct 6, 2022
@torvista
Copy link
Author

torvista commented Oct 6, 2022

I haven't been very active lately

I noticed. I hope that is due to things under your control.

I'm too busy as well. I just set this to public for the moment. I always need a long mental preparation before I feel I can cope with delving into DPU.

@Zen4All
Copy link
Member

Zen4All commented Oct 6, 2022

Partially my own control, and some just life getting it's way. But I am doing fine.
Like you I just need some preparation and motivation to start this all up again.
Also I have been struggling with this mod in combination with the SBA and Product Bundle mod (still in beta). I would like to combine those three into one ultimate mod. This also makes me less motivated to update just DPU.

@torvista
Copy link
Author

torvista commented Oct 6, 2022

I would like to combine those three into one ultimate mod

Personally I would not like that. I don't user either of the other two/use alternatives.

Can we not get DPU into core? These days it is to be expected that the displayed price is updated with an attribute selection: seems a basic feature that is lacking.

@Zen4All
Copy link
Member

Zen4All commented Oct 6, 2022

Personally I would not like that. I don't user either of the other two/use alternatives.

I understand 😃

Can we not get DPU into core? These days it is to be expected that the displayed price is updated with an attribute selection: seems a basic feature that is lacking.

That would be the best option IMHO

For now I have merged your dev branch into mine

@torvista
Copy link
Author

torvista commented Oct 19, 2023

To reiterate that DPU Dynamic Price updater (includes/classes/ajax/zcDPU_Ajax.php) requires this change in \includes\classes\shopping_cart.php
zencart/zencart#6011

    protected $total_before_discounts;

to

    //protected $total_before_discounts; //for zcDPU_Ajax.php
    public $total_before_discounts;

@torvista
Copy link
Author

torvista commented Oct 23, 2023

It's been pointed out to me (thanks) and I'll document it here:

If DPU extends the shopping cart class, then
the shopping cart class' protected members can become accessible by DPU while still supporting notifiers.

Unfortunately I can't figure out how to do this....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants