Post by eric_hsu » Tue Jun 05, 2012 1:28 pm

I've solved my problem after installing the "clear cache" extension. it's really the catch problem.
Besides, I have another problem with "Default Group Discount" of "Customer group".
Can you tell me how to make it work and what's the function on it?

Regards,
Eric

Newbie

Posts

Joined
Thu May 31, 2012 3:23 pm

Post by eric_hsu » Tue Jun 05, 2012 1:29 pm

eric_hsu wrote:
madimar wrote:Try to clean system/cache folder, maybe it is related to the same issue I was reporting
Thanks for your advise, it really works.

Newbie

Posts

Joined
Thu May 31, 2012 3:23 pm

Post by AvanOsch » Tue Jun 05, 2012 6:07 pm

madimar wrote:AvantOsch,
I'm finally testing your contribution. I'm just thinking about again to the nested category point. It could be really great if a discount set to a category could be propagated to all its nested categories. At the moment, for my needs, this is a fundamental point.
Do you think it could be feasible?
It's feasible, but unnecessary IMO...
You can go to Catalog --> Categories, Select the parent category and all it's children, and set the discount(s) for those categories from there using the Discounts Dialog...

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by AvanOsch » Tue Jun 05, 2012 6:14 pm

eric_hsu wrote:I've solved my problem after installing the "clear cache" extension. it's really the catch problem.
Besides, I have another problem with "Default Group Discount" of "Customer group".
Can you tell me how to make it work and what's the function on it?
Hello Eric,

It's meant so set a Default discount for all Categories/Products/Options for a certain customer group.
If the discount-percentage should be the same throughout the catalog, you can set it with the "Default Group Discount".
This discount will be applied if no other discount is set for a Category/Product/Option.

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by mickyp » Thu Jun 07, 2012 12:50 am

AvanOsch wrote:
eric_hsu wrote:I've solved my problem after installing the "clear cache" extension. it's really the catch problem.
Besides, I have another problem with "Default Group Discount" of "Customer group".
Can you tell me how to make it work and what's the function on it?
Hello Eric,

It's meant so set a Default discount for all Categories/Products/Options for a certain customer group.
If the discount-percentage should be the same throughout the catalog, you can set it with the "Default Group Discount".
This discount will be applied if no other discount is set for a Category/Product/Option.
Hi, AvanOsch,

I found that there is a bug when the category discount is set to empty string.
When category discount is set to empty string, the group discount won't be calculated, the product price will no longer show the special price.

the source code in system/library/customer.php is

Code: Select all

public function getDiscount($pId) {
		$discount = false;
		$group_id = ($this->customer_group_id) ? $this->customer_group_id : (!$this->config->get('config_discount_login') ? $this->config->get('config_customer_group_id') : false);
		$query = $this->db->query("SELECT DISTINCT category_id as id FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$pId . "'");
		if ($query->num_rows && $group_id) {
			$query = $this->db->query("SELECT DISTINCT discounts FROM " . DB_PREFIX . "category WHERE category_id = '" . (int)$query->row['id'] . "'");
			if ($query->row['discounts'] && strpos($query->row['discounts'], '|')) {
				$discounts = explode(' ', $query->row['discounts']);
				foreach ($discounts as $group) {
					$group = explode('|', $group);
					if ($group[0] == $group_id) $discount = 1 - ((float)$group[1] / 100);
				}
			}
		}
		if (!$discount) {
			$discount = 1;
			if ($group_id) {
				$query = $this->db->query("SELECT DISTINCT discount FROM " . DB_PREFIX . "customer_group WHERE customer_group_id = '" . (int)$group_id . "'");
				if ($query->num_rows) $discount = 1 - ((float)$query->row['discount'] / 100);
			}
		}
		return $discount;
  	}
We should focus on this line
if ($group[0] == $group_id) $discount = 1 - ((float)$group[1] / 100);

When the category discount is set to empty string, the $group[1] will be the empty string. And hence you can't calculate an "empty string divide by 100" <-- non sense.
So the $discount will always be set to some value, and cause the group discount failed to calculate.

Or the bug is caused by the category table has dirty discounts?!
I mean when I clear all content inside the category discount page, I found the category table in the database still have some value like "1| 2| 3|" in the discounts field.
And this situation cause the line
if ($query->row['discounts'] && strpos($query->row['discounts'], '|')) {
go pass to inside statements... perhaps

The temporarily solution I use is to set category discount to 100% when I need a pure group discount, so that the special price is shown up correctly.


Hope there will be a bug fixed version for this.



Sincerely,
Micky

Newbie

Posts

Joined
Mon Apr 09, 2012 12:16 am

Post by dunn123 » Thu Jun 07, 2012 2:26 am

Hi
I have installed your mod on a site of mine but having two issues.

1. The discount on options for customer groups isnt being applied. I can log in as a trade customer go to a product, the base price is reduced from the discount assigned to the customer group but no discount applied to the options.

2. if I add a product to the shopping basket it adds it at the default price not the discounted one.

Any insight would be appreciated.

Thanks
Chris

New member

Posts

Joined
Wed Mar 02, 2011 7:40 pm

Post by AvanOsch » Thu Jun 07, 2012 5:21 am

mickyp wrote: I found that there is a bug when the category discount is set to empty string.
When category discount is set to empty string, the group discount won't be calculated, the product price will no longer show the special price.
..............
We should focus on this line
if ($group[0] == $group_id) $discount = 1 - ((float)$group[1] / 100);

When the category discount is set to empty string, the $group[1] will be the empty string. And hence you can't calculate an "empty string divide by 100" <-- non sense.
So the $discount will always be set to some value, and cause the group discount failed to calculate.

Or the bug is caused by the category table has dirty discounts?!
I mean when I clear all content inside the category discount page, I found the category table in the database still have some value like "1| 2| 3|" in the discounts field.
..................
Sincerely,
Micky
Thanks for the bug-report, Micky. (As that is indeed a bug)

I'm thinking the problem is with the "dirty" tables... (As (float) 0 divided by 100 is still 0) (0/100=0)
There should be no saved values after deleting the discount (making them empty, not "0")

I'll look into this.
dunn123 wrote: 1. The discount on options for customer groups isnt being applied. I can log in as a trade customer go to a product, the base price is reduced from the discount assigned to the customer group but no discount applied to the options.
2. if I add a product to the shopping basket it adds it at the default price not the discounted one.
Dunn123, I think (hope :-\ ) those bugs have to do with the previously reported cache-problem.
However... problem 1 seems different...
Are you sure the options don't have discount 0% set? (instead of an empty value?)

I'll look into these problems too...

I'm having a little trouble finding the time, as I also have a day job.
Amma get to it asap.

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by dunn123 » Thu Jun 07, 2012 8:46 pm

Hi
Thanks for your reply.

Solved it. Think it was a combination of things. the default % was set to zero instead of blank. All though this did not initially change anything I cthen leared the vqcache ( I had already cleared the system cache to no avail) closed and restarted firefox and tried again with success. All seems to work fine.

Thanks again.
Chris

New member

Posts

Joined
Wed Mar 02, 2011 7:40 pm

Post by dunn123 » Thu Jun 07, 2012 10:31 pm

Hi
I am wondering if there is a way to assign an option price by customer group with a fixed amount not a % discount.

The scenario I have is my client has 4 customer groups.
Default, Perfomrers - 20% off, Education 25% off and Wholesale fixed amount by product. This is fine apart from on options that change the price.

Your mod works great for the % based discounts but I am struglling with the fixed price discount. Any ideas would be appreciated.

Regards
Chris

New member

Posts

Joined
Wed Mar 02, 2011 7:40 pm

Post by AvanOsch » Thu Jun 07, 2012 10:52 pm

dunn123 wrote:Hi
I am wondering if there is a way to assign an option price by customer group with a fixed amount not a % discount.
.............
Your mod works great for the % based discounts but I am struglling with the fixed price discount. Any ideas would be appreciated.
Hi Chris,

Sorry, only % based discounts...
That's the way this mod works. It takes the normal price, and "multiplies" it with the set discount...

Thanks to "Product Specials" we are able to set multiple fixed prices for products.
As there is no such thing for Options, this is (currently) not possible.
Adding this functionality would require A LOT of code changes to A LOT of files... (No plans for adding this feature)

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by dunn123 » Thu Jun 07, 2012 11:07 pm

Thanks for the feedback. Atleast i can stop scouring the net for a solution.

Cheers
Chris

New member

Posts

Joined
Wed Mar 02, 2011 7:40 pm

Post by madimar » Tue Jun 12, 2012 6:07 pm

AvanOsch wrote:
madimar wrote:AvantOsch,
I'm finally testing your contribution. I'm just thinking about again to the nested category point. It could be really great if a discount set to a category could be propagated to all its nested categories. At the moment, for my needs, this is a fundamental point.
Do you think it could be feasible?
It's feasible, but unnecessary IMO...
You can go to Catalog --> Categories, Select the parent category and all it's children, and set the discount(s) for those categories from there using the Discounts Dialog...
I understand your point but if you have a lot of categories it can be complicate. What I'd like to have is something the following:

PARENT with 20 children: CHILD-1, CHILD-2, ... CHILD-20

I set a discount to PARENT of 10% and the discount is generally inherited to all children.
I set a discount only on CHILD-15 of 20%. This discount overrides the inherited discount.

This mechanism should apply also with more level of nested categories.

M

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by madimar » Tue Jun 12, 2012 6:12 pm

AvanOsch wrote: Dunn123, I think (hope :-\ ) those bugs have to do with the previously reported cache-problem.
Amma get to it asap.
Hi great AvanOsch, I know your work is free and you don't have too much time to work on it, but... are you going to work on a fix for caching problem? Just to know,

thank you really for your work,

M

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by AvanOsch » Tue Jun 12, 2012 8:29 pm

madimar wrote:are you going to work on a fix for caching problem?
Hi M,

Yes I am.
I'll also have a look into the possibility of getting the parent category's discount, when a child has no discount set.
I don't know if that is simple to add, or a whole lot of work...
I'll need to have a look....

Caching problem is first though.

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by madimar » Wed Jun 13, 2012 12:35 am

Great, thank you.

M

Sent from my DesireHD.

-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------


User avatar
Active Member

Posts

Joined
Thu Sep 24, 2009 6:27 pm


Post by AvanOsch » Thu Jun 21, 2012 10:23 am

Extension updated to v1.0.4

- Caching problems should now be solved.
- Added "Child inherits discounts from Parent" as Madimar suggested.
- I compared the code with OpenCart v1.5.3.1 too, and made sure vQMod validates there too.
I did not test in v1.5.3.1 yet though...

Let me know what you think.

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by cpeltier » Sat Jun 23, 2012 2:23 am

Just installed your update on 1.5.3.1. Haven't checked it all out. Will it still take graduated discounts, ie: 500:30%,1000:35%,1500:40%,999999:40% for a customer group discount?

Newbie

Posts

Joined
Thu Jun 14, 2012 4:22 am

Post by cpeltier » Sat Jun 23, 2012 2:25 am

Am testing now on 1.5.31. Will it still take graduating discounts, ie 500:30%,1000:35%,1500:40%,999999:40% in the group discount? Sorry if this double posts.

Newbie

Posts

Joined
Thu Jun 14, 2012 4:22 am

Post by AvanOsch » Sat Jun 23, 2012 4:34 am

cpeltier wrote:Am testing now on 1.5.31. Will it still take graduating discounts, ie 500:30%,1000:35%,1500:40%,999999:40% in the group discount? Sorry if this double posts.
Nope.
Never did, (probably) never will...

User avatar
Active Member

Posts

Joined
Sat Sep 03, 2011 9:17 pm

Post by BabyPico » Sun Jul 01, 2012 10:21 pm

Hi,

Just installed customer group discount and just what I wanted. Thanks for the free mod.

I'm zero in codings hence don't know how to solve.

1) I believe this is a case of mod clashing where this error comes out on top of my homepage and product page at the frontend and in my system error log.

http://vvcap.net/db/MBJ6XfUrfzOqV8w3ufK9.htp

I think its clashing because once I uninstalled the ''customer group name' mod, or once I logged in as a customer (when its the mod is installed) the error disappears.

This mod just basically shows the customer group name in brackets next to the customer name.

http://vvcap.net/db/jphCW3xLz30hZkOF4SPt.htp


2) My vqmod error log on the other hand shows another error (with or without the clashing mod installed)


---------- Date: 2012-07-01 21:47:25 ~ IP : ... ----------
REQUEST URI : /defaultcart/admin/index.php?route=module/vqmod_manager/vqmod_install&token=54f9939257a30263071abdd465679502&vqmod=customer_id_home_page
MOD DETAILS:
modFile : /home/.../defaultcart/vqmod/xml/GroupDiscounts.xml
id : Customer Group Discounts
version : 1.0.3
vqmver : 2.1.5
author : The Wizard of Osch, for www.CrystalCopy.nl
Could not resolve path for [admin/language/dutch/catalog/category.php] (SKIPPED)
Could not resolve path for [admin/language/dutch/catalog/option.php] (SKIPPED)
Could not resolve path for [admin/language/dutch/sale/customer_group.php] (SKIPPED)
Could not resolve path for [admin/language/dutch/setting/setting.php] (SKIPPED)
Could not resolve path for [admin/language/dutch/setting/store.php] (SKIPPED)

----------------------------------------------------------------------

Though this error do me no harm but its filling up my vqmod error log


May I know anyway I can fix both of these?

Thanks!

Newbie

Posts

Joined
Sun Apr 15, 2012 12:22 pm
Who is online

Users browsing this forum: No registered users and 1 guest