Author Topic: Shopper Group Extension v0.7.70 and v1.1.5  (Read 253622 times)

Daniel Jonsson

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 109
Shopper Group Extension v0.7.70 and v1.1.5
« on: January 22, 2008, 11:55:53 am »
This hack will change how the shopper group works in Virtuemart. Products can now be displayed on shopper group base. The category menu will be shorten if there isn't any products in the category.

This project is under development, so not all functions are active and it hasn't been tested enough. So use it at your own risk. I have uploaded all the files I changed and removed the old code to clean up the thread.

Supports:
* Shopper group control of viewable products
* Shopper group control of buyable products
* Shopper group control of searchable products
* Shopper group controlled payment modules
* Shopper group controlled shipping modules
* Shopper group controlled terms of service
* Shopper group controlled minimum buy value
* Shopper group controlled free shipping amount
* Shopper group controlled street price
* Shopper group controlled product discount
* Fixes to some of the original files connected to everything
* Updated to support Virtuemart v1.0.15.
* Optimization of some SQL questions for increased speed.
* Much much more, since the hack is 800kB big and still in beta testing.

Some of the changes might screw up some of your modules since changes has been done to both menus, shipping methods, payment methods and also to tables. If there is any problem just contact me and I might be able to help you with problems connected to this hack.
 
Going to be added:
* CVS upload support
* Fixes for DIBS payment module to work with this patch.

Information:
The street price is little bit special since layout is controlled from the language files, please read the readme file. This means that you can control layout and use the street price for everything from show street price, show prices including moms to show recommended customer price to retailers.

This hack is not recommended to use on a live site, even if it is tested on live sites, and the hack is used at your own risk!

I got the question earlier if I was going to implement this for Virtuemart v1.1 also and I can announce that I attend to do that, if I have enough time.

News:
Changes done to product listing shows promising speed result.

Version information:
v0.7.01:English language file bugfixed, (english.php).
v0.7.02:Shopper group control from products bugfixed because of changes to the table jos_vm_product_shopper_group_xref in v0.5.90, (ps_product.php).
v0.7.50Fixed some bugs. Added select all support. Added full shopper group control on creation of products. Applied the changes done for Virtuemart v1.0.15.
v0.7.52Fixed some bugs. Added limit support for listing with multiple lists. Italian Language added by Pisu.
v0.7.60Fixed some bugs. Added product discount support to shopper group. Cleaned up the admin GUI.
v0.7.70Bug fixes and added new tag to product pages.

Added a small extension that makes it possible to have templates for the category. It also fixes a bug in the add to cart button on the browse view.

/Best wishes, Daniel

WARNING: FILES BELOW IS NOT SUPPORTED ANY LONGER AND WORKS ONLY ON VIRTUEMART v1.0.

If you need the Shopper Group Extension for Virtuemart v1.1. Please send a mail to me with the information about yourself, your company, your project and your site/customers site.

Contact information can be found on my webpage http://www.xclude.se
Installation manual and a Release Candidate 1 is available from the site. Bugreports can be posted from site. Please, register to get access.


[attachment cleanup by admin]
Donations are appreciated.

ddc441

  • Jr. Member
  • **
  • Posts: 66
Re: Customer Group Access Restriction Implementation v0.51
« Reply #1 on: February 06, 2008, 02:06:07 am »
Thanks for all the hard work!

I seem to be having a problem with the code changes to my vm_JSCOOK.php file.

My file does not have this code referenced in step 7a:
Code: [Select]
$query = "SELECT #__{vm}_category.category_name, #__{vm}_category.category_id, #__{vm}_category_xref.category_child_id "
        ."FROM #__{vm}_category, #__{vm}_category_xref WHERE #__{vm}_category.category_publish='Y' "
        ."AND #__{vm}_category_xref.category_parent_id='$category_id' AND #__{vm}_category.category_id=#__{vm}_category_xref.category_child_id ";

Could you be using a newer version? My unmodified file looks like this:

Code: [Select]
class MamboMartMenu {
    /***************************************************
    * function traverse_tree_down
    */
    function traverse_tree_down(&$mymenu_content, $category_id='0', $level='0') {
        static $ibg = 0;
        global $module, $mosConfig_live_site, $sess;
        $level++;
        $query = "SELECT category_name, category_id, category_child_id "
        . "FROM #__{vm}_category as a, #__{vm}_category_xref as b "
         . "WHERE a.category_publish='Y' AND "
         . " b.category_parent_id='$category_id' AND a.category_id=b.category_child_id "
         . "ORDER BY category_parent_id, list_order, category_name ASC";
        $db = new ps_DB();
        $db->query( $query );
       
while($db->next_record()) {
            $itemid = '&Itemid='.$sess->getShopItemid();
            if( $ibg != 0 )
              $mymenu_content.= ",";
             
            $mymenu_content.= "\n['<img src=\"$mosConfig_live_site/components/com_virtuemart/js/ThemeXP/darrow.png\">','".$db->f("category_name")."','".sefRelToAbs('index.php?option=com_virtuemart&page=shop.browse&category_id='.$db->f("category_id").$itemid)."',null,'".$db->f("category_name")."'\n ";
           
            $ibg++;
               
            /* recurse through the subcategories */
            $this->traverse_tree_down($mymenu_content, $db->f("category_child_id"), $level);
           
            /* let's see if the loop has reached its end */
            $mymenu_content.= "]";
               
        }
    }
}

?>

I'm haviing a few more errors but I'm sure it due to mistakes I made changing the rest of the code.

Thanks for your help!

ddc441

  • Jr. Member
  • **
  • Posts: 66
Re: Customer Group Access Restriction Implementation v0.51
« Reply #2 on: February 06, 2008, 16:48:50 pm »
Installed the VM_JSCook.php.

Thanks!

Two issues so far (they could related)


1. I get the following error when customer restrictions (cr) are enabled and I try to access the product details (product.product_form.php) in the VM backend.

Fatal error: Cannot instantiate non-existent class: vmpagenav in /home/douglasc/public_html/scentnet/administrator/components/com_virtuemart/html/product.product_form.php on line 1003.
 
Edit -Solved: Added the following line to the product.product_form.php and all is fine:
Code: [Select]
require_once( CLASSPATH .'pageNavigation.class.php');
2. When CR enabled... the admin category view says no products have been assigned to categories. The products return to the categoies when cr is disabled.

UPDATE: All the products reappear in the categories in the backend as soon as one product is assigned to a shopper's group. But no products are showing up in the categories on the frontend.

Two suggested features - an option/ability to mark all existing products as default when cr is enabled. Also, adding a "Customer Restrictions " list to the VM Products dropdown menu would be great.

Any suggestions?

Thanks!

ddc441

  • Jr. Member
  • **
  • Posts: 66
Re: Shopper Group Extension v0.55
« Reply #3 on: February 07, 2008, 23:59:32 pm »
All files loaded onto my dev server. It seems to be working fine. Only strange thing I see is in the "List Category" view. The product totals for each category have incorrect totals. For instance, the first category has nine products, but the total in the column 1530. See the attached gif for illustration.

Thanks!



[attachment cleanup by admin]

ddc441

  • Jr. Member
  • **
  • Posts: 66
Re: Shopper Group Extension v0.55
« Reply #4 on: February 09, 2008, 01:28:22 am »
Thanks. Found another bug. The "add to cart" function is missing in the product details. It displays the icon, but there but no text. I'll reload VM to confirm it was caused by these mods.

Edit: Correction - The function still works. The item is added to the cart. But the words "Add to Cart" (PHPSHOP_CART_ADD_TO) is not appearing on the page. Also, when the item is added to the cart, it redirects back to the product category... not the cart.

I replaced the shop.product_details.php file with the orginal, and the problem goes away. As expected with the original file any customer can access and order a restricted product if they manually type in the itemid in the url.

ddc441

  • Jr. Member
  • **
  • Posts: 66
Re: Shopper Group Extension v0.5.61
« Reply #5 on: February 12, 2008, 00:18:11 am »
Okay. I just added those back in. I should have checked the code a little closer.

Another suggestion... is it possible to hide the products from a search? Right now, it appears anyone can find them in a search (but they are prevented from viewing the product details).

So far, this seems to be working great! Good work!

ddc441

  • Jr. Member
  • **
  • Posts: 66
Re: Shopper Group Extension v0.5.61
« Reply #6 on: February 14, 2008, 01:31:12 am »
I decided to try a small beta test on a live site and ran into the following situation.

When members of the new shoppers group try to check out, they get the following error when they submit their order.

Error: Failure in Processing the Payment. Technical Note: The required transaction key is empty! The payment method settings must be reviewed.
Error: Failure in Processing the Payment (ps_authorize).

I assume the issue is with lines 278-285 of ps_authorize.php, but I can't figure out what the problem is.
Code: [Select]
// Get the Transaction Key securely from the database
$database->query( "SELECT DECODE(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."' AND shopper_group_id='".$auth['shopper_group_id']."'" );
$transaction = $database->record[0];
if( empty($transaction->passkey)) {
$vmLogger->err( $VM_LANG->_PHPSHOP_PAYMENT_ERROR.'. Technical Note: The required transaction key is empty! The payment method settings must be reviewed.' );
return false;
}

I added another payment method duplicating the AN method and assign it to the new group although that's only for discounts. Got the same errors. If I switch the shopper back to the default group with while the item is still in the cart, then the checkout goes without a problem.

Hope that all makes sense.  :)

Daniel Jonsson

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 109
Re: Shopper Group Extension v0.5.87
« Reply #7 on: February 25, 2008, 17:42:02 pm »
Removed a bug in ps_payment_method.php.

Correct number of creditcard types should be shown. Working on adding the shipping control for the shopper group.

When shopper group extension is working for Virtuemart 1.0.x. It will be moved over to Virtuemart 1.1 and hopefully ready for the final release.

/Best wishes, Daniel
Donations are appreciated.

juppjupp

  • Jr. Member
  • **
  • Posts: 88
Re: Shopper Group Extension v0.7.00
« Reply #8 on: February 28, 2008, 15:28:29 pm »
Hi Daniel, I have had no luck on this in the virtuemart forum...

I simply want to disable/hide (checkbox?) the discount sat on the product details page so that it not applies to the other (wholesale) shopper groups price... (we have got two prices on one product)

I only want the default customer (shopper group) to see/get the discount.

Can your hack do this for me? :)

Daniel Jonsson

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 109
Re: Shopper Group Extension v0.7.00
« Reply #9 on: February 28, 2008, 17:05:33 pm »
I might be able to help you on that.. I will add a feature that connects products discounts based on shopper group. It's  next on my todo list. It should solve your problem. My small hack does actually just control view and individual setup of groups of shoppers. But I will add a discount system to it also. If your lucky it will be uploaded tomorrow.

/Best wishes, Daniel
Donations are appreciated.

juppjupp

  • Jr. Member
  • **
  • Posts: 88
Re: Shopper Group Extension v0.7.00
« Reply #10 on: February 29, 2008, 09:10:03 am »
Ah, cool... I have really put some time into finding how to do this...

Have you seen Pisu´s "street price" hack? Maybe it could be merged into this hack :D would rule totally!,
and is a must-have for businesses! :)

http://forum.virtuemart.net/index.php?topic=24118.msg63265

BTW, does this hack work with VM 1.0.13a, all languages? :)

T.


Daniel Jonsson

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 109
Re: Shopper Group Extension v0.7.00
« Reply #11 on: February 29, 2008, 10:10:30 am »
I haven't looked at the street hack yet. But I will take a look at it. This hack should work with VM 1.0.x... It has been tested on 1.0.13 and 1.0.14. The language part should also work. You might have to add some of the tags, since only English and Swedish is included. But most language addons are for the admin interface.

I have been thinking about adding show customer price function since I'm making this hack for a webshop that aims at resellers.

/Daniel

Donations are appreciated.

juppjupp

  • Jr. Member
  • **
  • Posts: 88
Re: Shopper Group Extension v0.7.00
« Reply #12 on: February 29, 2008, 10:21:51 am »
Sounds tremendous!! :D  What about making a small hack wich enables multiple download links in the "my details"
menu for different shopper groups. This to give access to a pdf-catalogue(s)/lists for example, with wholesale/reseller prices wich
end users (default shoper group) shall not see.

T.

Daniel Jonsson

  • Contributing Developer
  • Jr. Member
  • *
  • Posts: 109
Re: Shopper Group Extension v0.7.00
« Reply #13 on: February 29, 2008, 10:29:38 am »
This is actually partly supported already...

You need to setup downloadable product and then just connect them to a specific shopper group and you are on the road. Then just add a link to the category from your show "my details" page (administrator/components/com_virtuemart/classes/account.index.php).

You can name the category catalogue, just add the price 0 to each downloadable product and add the link to the category in the account.index.php and you can do exactly what you are talking about.

If you want to do it easier just skipp the account.index part and just add a category.

/Daniel
Donations are appreciated.

juppjupp

  • Jr. Member
  • **
  • Posts: 88
Re: Shopper Group Extension v0.7.00
« Reply #14 on: February 29, 2008, 10:40:52 am »
Ah cool! Because your hack does not show a certain (PDF-files) category to default user if linked to wholesale, correct? :)

It would also be nice if the "street price" hack could show street price including their default shopper group tax, why?
Because the wholesale/reseller have got disabled show prices incl tax :), and the wholesale/reseller don´t have to
add the 25% tax when calculating the price to a street customer..