Post by ankur0101 » Wed Jul 16, 2008 9:48 pm

In my shop, a " user should buy atleast 6KG that means 6000grams of goods
if the goods are less than 6000grams, it will show error.....look at the photo

there is "Continue" button at right side
if order is less than 6000 grams, the button will be disable & below button there will be a note
"Sorry, cannot continue, Your order is less than 6000 grams"

PLEASE ANY CODER, DEVELOPER, ADMINISTRATOR I NEED HELP HERE

THANKS

Attachments

???
shop.JPG

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by JNeuhoff » Thu Jul 17, 2008 2:00 am

I think this will require a modification in the file '/catalog/extension/shipping/zone.php': In method 'quote' , before it returns the $method_data, it should check for the total weight to be at least 6KG, if not, set the 'error' property in $method_data before returning it. This can then be checked in the '/catalog/template/default/content/checkout_shipping.tpl' template: If error is set, skip the generation of the continue button.

If you are interested, PM me, it shouldn't take me more than a working day to implement, at a low cost.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by bruce » Thu Jul 17, 2008 8:15 am

You might look at putting a validate function in the cart controller. That way, they could never progress to checkout if the order is not sufficient.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by ankur0101 » Thu Jul 17, 2008 7:58 pm

thats right bruce
i think i have to edit the basket page...
http://demo.opencart.com/index.php?controller=cart
can anybody tell me where is that page located ??

i think

in this page if i set validation for weight, that if weight is less than 6000 grams then "Checkout" button should be disabled
and below the button there will be note "Buy atleast 6000 grams of goods."

i think i just have to edit these in basket page
am i right ?????
if yes how can i do that ????
please i need help

Thank you,

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by bruce » Thu Jul 17, 2008 9:24 pm

catalog\controller\cart.php you need to put your test in here somewhere.

catalog\template\default\content\cart.tpl  you need to put some logic in here to optionally display the checkout button.

The problem is larger though because the checkout button is still displayed in the header. You will have to put a similar test for a valid order amount in

catalog\controller\checkout_payment.php and redirect back to cart if the order is not valid.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by ankur0101 » Fri Jul 18, 2008 1:52 am

hello bruce, can you do it ???
tell me, how much time it may take ??? approximately ??

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by bruce » Fri Jul 18, 2008 9:38 pm

Jonathon, do you want to pick this up. I am really flat out at the moment.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by JNeuhoff » Tue Jul 22, 2008 6:28 pm

OK, you need to change the /catalog/extension/shipping/zone.php as follows:

Insert the following lines into function  __construct :
$this->config  =& $locator->get('config');
$this->weight  =& $locator->get('weight');
Add the following function after the __construct :

Code: Select all

	function getWeight() {
		$language = $this->language;
		$languageId = $language->languages[$language->code]['language_id'];
		
		$total = 0;
		foreach ($this->cart->products as $product) {
			$productId = $product['product_id'];
			$weight = $this->weight->convert($product['weight'] * $product['quantity'], $product['weight_class_id'], $this->config->get('config_weight_class_id'));
			$total += $weight;
    		}
		$defaultWeightClassId = $this->config->get('config_weight_class_id');
		$kgWeightClassId = 0;
		if ($row = $this->database->getRow( "select weight_class_id from `weight_class` where `unit`='kg' and language_id=$languageId;" )) {
			$kgWeightClassId = $row['weight_class_id'];
		}
		if ($kgWeightClassId == 0) {
			$error = $this->language->get('text_zone_error_unit' );
		}
		$weight = $this->weight->convert( $total, $defaultWeightClassId, $kgWeightClassId );
		return $weight;
	}

In function quote, near the end, change it as follows:

Code: Select all

		$weight = $this->getWeight();
		$method_data = array();
	
		if ($quote_data) {
      			$method_data = array(
        			'id'           => 'zone',
        			'title'        => $this->language->get('text_zone_title'),
        			'quote'        => $quote_data,
        			'tax_class_id' => $this->config->get('zone_tax_class_id'),
			'sort_order'   => $this->config->get('zone_sort_order'),
        			'error'        => ($weight < 6.0) ? $this->language->get('text_zone_error_weight' ) : false
      			);
		}
		return $method_data;

You also need to insert the following lines into file /catalog/language/english/extension/shipping/zone.php :

Code: Select all

$_['text_zone_error_unit']    = "Unable to convert product weights in 'kg' units";
$_['text_zone_error_weight']  = "No products can be shipped until the total minimum weight is at least 6 kg";
Finally, make sure that file /catalog/template/default/content/checkout_shipping.tpl gets updated on line 44, as follows:

Code: Select all

          <td colspan="2" class="g"><div class="warning"><?php $hasError=true; echo $method['error']; ?></div></td>
And the line 60 should be replaced by the lines:

Code: Select all

        <?php if ((!isset($hasError)) || (!$hasError)) { ?>
        <td align="right"><input type="submit" value="<?php echo $button_continue; ?>"></td>
        <?php } ?>
This is for OpenCart version 0.7.8. Hope this helps. Make sure you create backups before changing any files.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by ankur0101 » Tue Jul 22, 2008 7:55 pm

Thank you
very much
it also works on 7.7 version

i want to know how can i get my username & password ??
i forgot it

how can i get it back or reset it

??
thank you

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by ankur0101 » Tue Jul 22, 2008 8:16 pm

something is going wrong/.....
i add new product & set its weight in 20KG

it should proceed for checkout but it shows error of 6kg

also i want to add 1 thing....
if weight is 6kg, then $12 will be charged
if weight is 7kg, then $14 will be charged
if weight is 8kg, then $16 will be charged
if weight is 9kg, then $20 will be charged

like that

i am using 0.7.7 version

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by ankur0101 » Tue Jul 22, 2008 8:19 pm

i think there is something called bug

i cannot edit any products weight
when i changes & re checks , it shows 999.99 Grams

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by JNeuhoff » Wed Jul 23, 2008 5:52 pm

You need to set up the Zone-shipping module.

In your OpenCart's admin panel, select Extensions > Shipping.

This will list the installed shipping modules. If the 'zone' shipping module hasn't yet been installed, click on the Insert button and fill in the details, as follows:
General:
  Extension Name: whatever you like
  Description: a brief description
Data:
  Code: zone
  Directory: shipping
  Filename: zone.php (or whatever the name of your modified zone-shipping file)
  Controller: shipping_zone

Now click on the List icon. The list will now include your zone-shipping module. Click on its Configure-icon (located at the right) and enter the following:
Shipping Zone 1 Status: Enabled
Shipping Zone 1 Cost: 6:12,7:14,8:16,9:20  etc.
Also select tax zones and tax classes as appropriate for your area.

The format of the shipping zone costs basically is a comma-separated list of
weight1:cost1,weight2:cost2,weight3:cost3 etc.
meaning this: any shipment up to 6.000 kg costs $12.00, between 6.001kg up to 7.000kg costs $14.00, between 7.001kg up to 8.000kg costs $16.00 etc.

I haven't tested the zone-shipping, I just gathered this information from other forum posts, corrections welcome if I am wrong.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JNeuhoff » Wed Jul 23, 2008 6:48 pm

On another note: You define your zones in your OpenCart's admin panel under the menu:

Admin > Configuration > Localization > Geo Zone

Each zone defined will be included in your zone shipping module, provided you enable them in there.



Also, your tax classes are to be defined in your OpenCart's admin panel under the menu:

Admin > Configuration > Localization > Tax Class

The tax class is to be selected when configuring your zone shipping module, or your can select none.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by ankur0101 » Thu Jul 24, 2008 1:20 am

thank you
actually i am in india and i want to export food products all over the world
here is my demo site
http://www.tempdemo.66ghz.com/
i am using 0.7.7
in 0.7.8, i  cannot see anything in modules ......

so in forum, some admin told me to use 0.7.7

and sir, the code which you gave me is working
but i buy products of 12kg but still error "No products can be shipped until the total minimum weight is at least 6 kg"
appears
you told me that use this on 0.7.8 , but i am using 0.7.7

please sir i need your serious help

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by ankur0101 » Thu Jul 24, 2008 1:38 am

so finally which version i have to choose ??

i want that 6 KG error
>> if products weight is less that 6 KG , it will show error

i want zone shipping tax which varies from country to country....
>> USA citizen will have to pay tax of $12 , Australian citizen will have to tax of $17

i want to use 6KGs weight charges
>> if goods weight is 6kg, then customer should pay $17
    if goods weight is 7kg, then customer should pay $19
    if goods weight is 8kg, then customer should pay $11
    if goods weight is 9kg, then customer should pay $17
and so on till 20KG


well when zone tax and above 6 KGs weight rate will added, then there comes final amount which consumer should pay

i got that 6 KGs criteria and coding which is in 0.7.8
finally which version i have to choose ???????????

PLEASE SIR I NEED HELP
Thank you

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by JNeuhoff » Thu Jul 24, 2008 9:58 pm

so finally which version i have to choose ??
Go with version 0.7.8. There are some issues which are all documented on this forum:

1) Edit the zone-module for the 6KG limit as per my previous message on this forum thread.
2) Edit file /library/environment/url.php. In function create, the last line should be:

Code: Select all

return $server . $link;
3) Make sure you have a proper '.htaccess' file in your web root directory:

Code: Select all

# Please ensure register_globals is Off by uncommenting this line
#php_flag register_globals Off

# URL Alias - see install.txt

Options +FollowSymlinks

<IfModule mod_rewrite.c>
RewriteEngine On

#OPENCART REWRITES START
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
#OPENCART REWRITES END

</IfModule>
I tested it on my test server, and it works fine. Of course you need to make sure that your products have appropriate weights.

If you use different shipping zones, you can edit and/or create them via OpenCart's admin panel:
Admin > Configuration > Localisation > Geo Zones

If you use different tax classes, you can edit and/or create them via OpenCart's admin panel:
Admin > Configuration > Localisation > Tax Class
The tax classes are based on a selected geo zones.

The zone-shipping module should pick up are your geo-zones automatically.
You still need to enable them in there and add your weights:prices lists for each geo-zone.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by ankur0101 » Thu Jul 31, 2008 9:01 pm

i gott everything except

return $server . $link;

i am confused that where should i post..

Sir, can you send me the whole page code ??


please sir

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by ankur0101 » Thu Jul 31, 2008 9:06 pm

in payment,
there is a Zone tab

but i want paypal

how can i do that ??

Website Hosting Mumbai Domain Registration Mumbai
Web Hosting India


New member

Posts

Joined
Tue Jul 15, 2008 6:59 pm


Post by JNeuhoff » Fri Aug 01, 2008 1:50 am

ankur0101 wrote: i gott everything except

return $server . $link;

i am confused that where should i post..

Sir, can you send me the whole page code ??


please sir
It's in file /library/environment/url.php, whose create function should look like this:

Code: Select all

	function create($server, $controller, $action = NULL, $query = array()) {
    		$link = 'controller=' . $controller;
    
		foreach ($query as $key => $value) {
	  		if ($value) {
	    		$link .= '&' . $key . '=' . $value;
	  		}
		}

    		if ($action) {
      			$link .= '&action=' . $action;
    		}
	
		if (isset($this->data[$link])) {
	  		$link = $this->data[$link];
		} else {
	  		$link = 'index.php?' . $link;
		}

		//remastered URLs out
		if (!preg_match('/\/admin\/index.php/',$_SERVER['PHP_SELF'])) { // not admin area
			$link=str_replace('controller=','',$link);
			$link=str_replace('&','/',$link);
			$link=str_replace('=','/',$link);
			$link=str_replace('index.php?','',$link);
		}

		return $server . $link;
	}

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 4 guests