ddenev
Retired Forum Member-
Posts
267 -
Joined
-
Last visited
About ddenev

ddenev's Achievements
Senior Member (3/3)
0
Reputation
-
Set currency and markup on a per product basis
ddenev replied to growe's topic in Third Party Add-ons
I am not talking about TYPE in the tblproducts table but in the tblpricing table. They have nothing in common. You must use the "type" column in your WHERE clause in order to restrict the resultset to one row. The relation between tblproducts and tblpricing is one-to -many with the relid field being the foreign key in the tblpricing table which points to the id field in the tblproducts table. That's why the query: SELECT * FROM `tblpricing` WHERE `relid`='$id' and `currency`='$default_currency_id'; will always return more than one row because you may have many rows in tblpricing which have the same relid value. This is simple SQL common knowledge. This is only the part of the problem. The second part is with the later UPDATE statements (one for each billing period): UPDATE `tblpricing` SET `monthly` = '$monthly' WHERE `relid`='$id' and `currency`='$default_currency_id'; The above will update several rows for the same reason as in the SELECT query - you do not restrict the UPDATE by the "type" column of the tblpricing table. This leads to updating all rows that have for example ID=1. And there are many with ID=1 but they all have different TYPE. Please study the WHMCS table structure in more depth and you will get what I'm talking about. Best regards -
Set currency and markup on a per product basis
ddenev replied to growe's topic in Third Party Add-ons
I checked the last version 1.5 but the bug that I reported in the previous post (# hasn't been fixed. Best regards -
Set currency and markup on a per product basis
ddenev replied to growe's topic in Third Party Add-ons
Yet another bug. In cron_Products.php, line 174: $sql3 = "SELECT * FROM `tblpricing` WHERE `relid`='$id' and `currency`='$default_currency_id';"; This will get all the prices, INCLUDING the prices for configurable options, domains, etc., because you did not restrict the query by type. And the problem is that after that you go and update the prices in tblpricing without restricting by 'type' column, thus updating the prices of config options, domains, etc. This leads to a complete mess in prices. Check the tblpricing table, there is a column named 'type'. You need to update only the rows that have the type set to 'product', not all. But since you are updating only by relid, this leads to a mess in pricing. And since the above select gets multiple rows, the mysql_fetch_array() will get only the first row and all the manipulations that you do after that will be applied to the wrong set of data. And that's why even if I set my prices to '-1.00', the addon does not respect that and overwrites these values (reported in a previous post by me). Also this addon does not take care of the prices set for configurable options and product addons (will not take care after the bugs above are fixed ). What if I have a product with configurable options which have prices set? It will update the prices of the product but will leave the prices of the config options unattended. The same goes for product addons. For me this addon doesn't work as advertised in it's current state. Even worse it can turn into a mess the pricing for a production site. It is good that I put it on a test environment and I have to fix the prices only for several products, config options and domains. But for a production installation where people could have hundreds of prices it could lead to serious problems. That's why I would advise anyone with a production site to delay the installation of the addon until all bugs are fixed. Best regards -
Set currency and markup on a per product basis
ddenev replied to growe's topic in Third Party Add-ons
Something else. Currently the addon has a problem working with UTF-8 databases - it outputs product name as question marks (??????). This is easily solvable by adding this statement immediately after the mysql_connect() call: mysql_query("SET NAMES 'utf8'", $conn); Best regards -
Set currency and markup on a per product basis
ddenev replied to growe's topic in Third Party Add-ons
cron_Products.php (v1.3): On line 83: $sql3 = "INSERT INTO `mod_products_currency` (`id`,`gid`,`name`,`base_currency`,`cost`,`hidden`,`order`) VALUES ('$id','$gid','$name','$default_currency','0.00','$hidden',$order');"; Look at the missing single-quote at the end, before the $order variable. This definitely produces an invalid SQL statement. I don't know how you manage to run an invalid SQL at your end but it doesn't work with me. Your CREATE TABLE statement is: CREATE TABLE IF NOT EXISTS `mod_products_currency` ( `id` int(10) NOT NULL, `gid` int(10) NOT NULL, `name` text NOT NULL, `hidden` text NOT NULL, `order` int(1) NOT NULL DEFAULT '0', `base_currency` text NOT NULL, `cost` decimal(10,2) NOT NULL, `markup_type` set('f','p') NOT NULL DEFAULT 'f', `markup` decimal(10,2) NOT NULL DEFAULT '0', `discount_type` set('f','p') NOT NULL DEFAULT 'f', `mdiscount` decimal(10,2) NOT NULL, `qdiscount` decimal(10,2) NOT NULL, `sdiscount` decimal(10,2) NOT NULL, `adiscount` decimal(10,2) NOT NULL, `bdiscount` decimal(10,2) NOT NULL, `tdiscount` decimal(10,2) NOT NULL, `msetupfee` decimal(10,2) NOT NULL, `qsetupfee` decimal(10,2) NOT NULL, `ssetupfee` decimal(10,2) NOT NULL, `asetupfee` decimal(10,2) NOT NULL, `bsetupfee` decimal(10,2) NOT NULL, `tsetupfee` decimal(10,2) NOT NULL, `monthly` decimal(10,2) NOT NULL, `quarterly` decimal(10,2) NOT NULL, `semiannually` decimal(10,2) NOT NULL, `annually` decimal(10,2) NOT NULL, `biennially` decimal(10,2) NOT NULL, `triennially` decimal(10,2) NOT NULL ); I don't see anywhere a mod_id column, so your statement is completely false. And just search for "mod_id" in CurrencyPriceUpdater.php and you will see. All occurrences of "mod_id" should be replaced with "id" because there is no column named "mod_id" in mod_products_currency table. Something else - you stated in the forum that the addon will ignore products that have values "-1" for their prices in the default currency and will not update their prices. I have a product with "-1" for all the billing periods with the default currency and when I set the cost for that product in the addon it updated the prices in WHMCS even though it shouldn't, according to your statement. Is this supposed to be like that or am I missing something? Thank you. Best regards -
Set currency and markup on a per product basis
ddenev replied to growe's topic in Third Party Add-ons
Have you ever tested the addon if it works before releasing it? I had to edit the code all over, fixing bugs, just to make it show properly. Really, testing before releasing would be a good idea, try it. List of bugs that I found so far (version 1.2): 1. Missing ' in the SQL query on line 84 in cron_Products.php 2. CurrencyPriceUpdater.php: a lot of SQL queries refer to column mod_id instead of id in the mod_products_currency table 3. The Deactivate Module function will not work properly becaus the SQL query contains wrong table name - mod_CurrencyPriceUpdater instead of mod_products_currency I really appreciate the free addon (thank you for your efforts) but it should at least work properly, shouldn't it? Best regards -
Hi, Looping through the {$invoice_Items} array in an email template does not show the first invoice item, i.e. the items are shown from the second onwards. The code is: {foreach from=$invoice_items item=item} ... {/foreach} The PDF version of the invoice shows the first item properly though. And in the email template the {$invoice_total} is also properly calculated and shown. Best regards
-
I'm glad it finally worked for you. Best regards
-
Please check if you have configured both the IP address and the hostname fields in Setup->Servers in WHMCS for your HyperVM server. They are both needed. Edit: I have updated the manual Best regards
-
This error means that there is a problem with the communication between the WHMCS server and the HyperVM server. In 90% of the cases the reason is misconfigured firewalls. Please try to shut down ALL firewalls between those servers and check again. Another two reasons could be: if you have configured WHMCS to connect to a HyperVM slave instead of to the master - the slaves do not provide API if you have setup the product to be of type "Dedicated/VPS" instead of "Other". These are the only reasons that I have met that lead to this error. Please check them and try again. I would recommend reading the manual carefully in order to eliminate any misconfigurations. Best regards
-
Well, I honestly don't know why the default module does not deploy your VPSs to a slave because I have tested it and it does this without a problem. My module also does this - in fact this is the purpose of both modules - to utilize the available HyperVM API in order to be able to deploy VPSs to both the master and slaves. The difference is only that my module has some more features than the default but they should work both in terms of deployment of VPSs to a HyperVM installation. Best regards
-
Showing the sub-account name in Support Tickets list
ddenev replied to ddenev's topic in Using WHMCS
Oh, I think I may have described the issue somehow unclear. Sorry for that. Actually I'm interested in understanding who submitted the actual replies to a support ticket. For example, suppose the main account is named Account and there are 2 sub-accounts - Sub-account1 and Sub-account2. If we have the following sequence: 1. Sub-account1 submits a new ticket 2. Our staff replies 3. Sub-account2 replies 4. Our staff replies 5. Sub-account1 replies then all the replies in the ticket will be shown as submitted by Account and there is no way to find out who actually replied - Account, Sub-account1, or Sub-account2. Even in the Log tab the entry for the reply is "New Ticket Response made by User". I hope it's clearer now Thank you. Best regards -
Showing the sub-account name in Support Tickets list
ddenev replied to ddenev's topic in Using WHMCS
Hi, Thank you for the reply. I checked and indeed in the CC field there is an e-mail address. But is this the address of the person who submitted the first ticked or the one that submitted the last ticket? Also, what if tickets are submitted by different persons (sub-accounts) - how do I see who submitted them? We actually need to make this differentiation because very often we call the actual submitter by the phone and most often this is not the main account. Best regards -
The vpsname field is a Custom Field and WHMCS already provides validation for custom fields via regular expressions. You can use that. See here for more info - http://wiki.whmcs.com/Custom_Fields#Regular_Expression_Validation Best regards
-
Hi, I have searched the forum but couldn't find any information on the topic that's why I'm posting a new question. Sorry if the question was already asked. The issue is that when a sub-account posts a support ticket from the client portal, the submitter of the ticket is shown as the name of the main account in the tickets list for the account. That way all the tickets are shown with the same name although tickets are submitted by different people. Is it possible that the actual sub-account name is shown in the tickets list for an account? I'm using WHMCS 4.2.1. Thank you in advance. Best regards
