Author Topic: Adding a product_uom and Session  (Read 5839 times)

Hexa

  • Beginner
  • *
  • Posts: 21
Adding a product_uom and Session
« on: July 06, 2005, 00:22:04 am »
Well, I guess I need a little help here. I have a customer that sells flooring. He wants to sell material in sqr-meters. Since these materials come in prepacked sizes I have to do a conversion here.

exp.: 12sqr-meters are needed but due to a packaging size of 5spr-meters, the customer would have to buy 3 packages.

Basically I want to round the quantity to the next multiple of some min-amount of the product.


What I did so far:
+ Added the fields: 'product_uom' , 'product_buy_multiple_of' to product-table and CSV-Table

+ Changed quantity from INT to DECIMAL(10,4)

+ Changed ereg calculations to allow for ',' and '.'


BUT:
I need those new fields in the cart. I kept on searching but I just can't find the file where to put those fields into the session. Using phpshop with debug turned on i see that there is an array storing typical product values -- but I just can't find the right file.

Any help would be appreciated.

Regards, Christian.

Hexa

  • Beginner
  • *
  • Posts: 21
Downloaded Dev-Manual - Now searching in parser.php
« Reply #1 on: July 06, 2005, 08:18:03 am »
Well, I just took a look in Sören's dev-manual to see that the parserfile should be the place to search for session-handling. So I will do just that. I'l post the mod when it's done.

Regards, Christian.

Hexa

  • Beginner
  • *
  • Posts: 21
Cleaning up and doublechecking
« Reply #2 on: July 07, 2005, 01:16:12 am »
I'm finally done. Cleanup is in progress. I will publish the hack here soon.

What I did:

+ added 'product_uom' for each product. This is displayed in cart, browse and product flypages

+ added 'buy_multiple_of' value. Customer can enter any quantity but quantity will be adjusted to be a multiple of that value. This is needed if you (see above) sell stuff in sqrfeet but a certain amount of sqrfeet are in a package. Now you can edit the new var to exp. 2.453sqrfeet/package and the quantity will be calculated to include only complete packages.

+ change quantity to float

files needing a change:
-----------------------
ps_cart.php
basket.php
basket*.html.php
ps_csv.php
browsepages
flypages

tables needing a change:
------------------------
#__pshop_product
#__pshop_order_item
#__pshop_csv


Regards, Christian

Hexa

  • Beginner
  • *
  • Posts: 21
Re: Adding a product_uom and Session
« Reply #3 on: July 12, 2005, 14:39:24 pm »
Hi.

While I was at it, I also added a 'skip first line' feature for csv-import and added a way to handle a csv-price that already has the vat/tax included. Since this vat/tax needs to be subtracted before the product is added to the shop-db, i wrote a few lines to accomplish this.

There are still some admin-functions missing, but I think this hack still is usefull (esp. for the people using csv-files). I sent Soeren a copy of the hack to allow him to have the 'first' look. Since there are some vital changes needed, I'd say it's worth the wait.

Regards, Christian.

surnux

  • Beginner
  • *
  • Posts: 1
Re: Adding a product_uom and Session
« Reply #4 on: April 13, 2006, 11:21:24 am »
Is there a complete description of the hack to add decimals to the product quantity. My knowledge of the shop and the databases is not that great, but i have the exact task as Hexa, to construct a site to sell flooring.

Kaddy

  • Beginner
  • *
  • Posts: 13
Re: Adding a product_uom and Session
« Reply #5 on: June 02, 2007, 09:17:47 am »
Newbie!! Please help
Is it possible in VM to use decimal values? Please help me with that problem.
I want to allow buyer to order in decimal amount e.g: 1.7kg or 0.35kg or what ever they want, but I don't want to set the price in grams.
Please help...

Kevin

  • Jr. Member
  • **
  • Posts: 84
    • Make a Donation
Re: Adding a product_uom and Session
« Reply #6 on: June 02, 2007, 23:56:37 pm »
Right now product_quantity is set to int(11), at the least you would have to change that to decimal(12,2).

Of course I am also a newbie.
If I have helped you then please feel free to leave a hat tip by clicking on the World to the left

Kaddy

  • Beginner
  • *
  • Posts: 13
decimal values
« Reply #7 on: June 03, 2007, 14:46:01 pm »
Right now product_quantity is set to int(11), at the least you would have to change that to decimal(12,2).

Of course I am also a newbie.

OK...
phpshop.sql
Changed quantity from INT to DECIMAL(10,4)
But the order list won't work. Quantity is INT. I want to be decimal.

Exactly which files I need to modify.
*Sorry for my english.

Thanks in advance.

[attachment cleanup by admin]