kenhar Posted August 5, 2014 Share Posted August 5, 2014 hi, I am using cubecart 5.2.12. In this how to display single product page in shipping price display. Any idea which code add in content.product.php file. Please help me. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 5, 2014 Share Posted August 5, 2014 Will this be the actual, real-time shipping charges for a particular shipping courier, or simply your best guess at what the charges should be? Quote Link to comment Share on other sites More sharing options...
kenhar Posted August 6, 2014 Author Share Posted August 6, 2014 hi, particular product page in display shipping price. check this link : http://46.163.115.30/spire-astro-ii-notebookst-tte-for-op-til-15-4.html in this Fragt kun 29 kr 29 is static value define this place in display original shipping price. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 6, 2014 Share Posted August 6, 2014 You say you are wanting a 'static value' to show shipping costs. I will recommend this mod: http://www.chuggyskins.co.uk/index.php?act=viewProd&productId=27 You can easily add (static) fields for shipping costs, shipping lead time, and all manner of details that would be stored with each product. (Unfortunately, because Chuggy is no longer a Commercial Member at www.cubecartforums.org, valuable information on how to easily setup and use this mod is no longer available. But I should be able to reproduce the instructions. --Yes, in fact, I saved the forum conversation.) Quote Link to comment Share on other sites More sharing options...
kenhar Posted August 6, 2014 Author Share Posted August 6, 2014 i want dynamic shipping price on product page. check above post link this page in display 29 shipping is static but i want's is dynamic. Quote Link to comment Share on other sites More sharing options...
kenhar Posted August 6, 2014 Author Share Posted August 6, 2014 hi, Any idea which place is store shipping by weight data. like: 0.25:29,0.5:38,1:49,10:58,30:89 this data is which place in store in data base or other. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 6, 2014 Share Posted August 6, 2014 CubeCart has a shipping module, By Weight, that will store your shipping rates. Since this does not change, and the product's weight is known when CubeCart is showing the product details, adding code to fetch the rate should be easy. The rates you enter are stored in the database, in the 'By_Weight' record of the CubeCart_modules table. I will have a solution shortly. Quote Link to comment Share on other sites More sharing options...
kenhar Posted August 7, 2014 Author Share Posted August 7, 2014 Thanks for reply. I know By_Weight record store in CubeCart_modules tables. But i want the admin in set or enter := 1st Class Shipping Rates : 0.25:29,0.5:38,1:49,10:58,30:89 2st Class Shipping Rates : 0:156,5:156,10:188,15:220,20:252,25:284,30:316,40:495,49:795,70:995,100:1495,600:3195 This value how to get in Content.product.php Please help me. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 7, 2014 Share Posted August 7, 2014 We are going to try the following solution by using a Code Snippet. These conditions apply: * The Customer must be logged in. * The customer must have at least one address in their address book, of which it is marked as 'default'. * The By Weight shipping module must have country ISO codes entered in the applicable zone blocks. In admin, Manage Hooks, Code Snippets tab, click Add Snippet. Fill in the following fields: Enabled: Green Check Unique ID: SonVPP@CubeCart Execution Order: 99 Description: Provides Shipping Data for View Product Page Trigger: class.catalogue.productassign Version: 1.0 Author: kenhar PHP Code:{php} $SonVPP['contents'][] = $product; $SonVPP['weight'] = $product['product_weight']; # Check if user has a default address (will check if user is logged in). If so, if( ($SonVPP['defAddresses'] = $GLOBALS['user']->getDefaultAddress()) !== false ) { foreach( $SonVPP['defAddresses'] as $address ) { if( $address['billing'] ) { $SonVPP['billing_address'] = $address; } else { $SonVPP['delivery_address'] = $address; } } # Check if By_Weight, Per_Category, AIO, By_Percent, By_Price, Flat_Rate, Per_Category, or Per_Item are enabled. If so, if(($SonVPP['shipping_modules'] = $GLOBALS['db']->select('CubeCart_modules', array('folder', 'countries'), array('module' => 'shipping', 'status' => '1'))) !== false) { foreach( $SonVPP['shipping_modules'] as $module ) { $module['countries'] = Config::getInstance()->get($module['folder'], 'countries'); $SonVPP['countries'] = (!empty($module['countries'])) ? unserialize($module['countries']) : false; $module['disabled_countries'] = Config::getInstance()->get($module['folder'], 'disabled_countries'); $SonVPP['disabled_countries'] = (!empty($module['disabled_countries'])) ? unserialize($module['disabled_countries']) : false; if( $GLOBALS['cart']->checkShippingModuleCountry($SonVPP['countries'],'enabled') || $GLOBALS['cart']->checkShippingModuleCountry($SonVPP['disabled_countries'],'disabled') ) continue; $SonVPP['class'] = CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'shipping'.CC_DS.$module['folder'].CC_DS.'shipping.class.php'; if( file_exists($SonVPP['class']) ) { // Version 5 Shipping Calculators // fix for duplicate shipping module entries in config table if( !class_exists($module['folder']) ) include $SonVPP['class']; // Instantiating this module's shipping class and calculating. if( class_exists($module['folder']) && method_exists((string)$module['folder'], 'calculate') ) { $SonVPP_shipping = new $module['folder']($SonVPP); $SonVPP['packages'] = $SonVPP_shipping->calculate(); if( $SonVPP['packages'] ) { uasort( $SonVPP['packages'], 'price_sort' ); $SonVPP['shipArray'][$module['folder']] = $SonVPP['packages']; } } else { /* This shipping module does not have a shipping calculator. */ } } } foreach ($GLOBALS['hooks']->load('class.cart.load_shipping') as $hook) include $hook; if (isset($SonVPP['shipArray']) && is_array($SonVPP['shipArray'])) { /* We have a shipping array.*/ $product['shipArray'] = $SonVPP['shipArray']; } else { /* No shipping option is available due to Allowed/Disabled zones restriction. */ } } else { /* No shipping is available due to no shipping modules found. */ } } else { /* Failed to get addresses. */ } return; {/php} You now have an array as part of the skin variable $PRODUCT array. As an example of how to use this data, in the skin template file content.product.php, enter the following code where you want the shipping cost for this product to appear:{if $PRODUCT.shipArray} {foreach $PRODUCT.shipArray as $shipper => $package} {$shipper}: {TAX::getInstance()->priceFormat($package.0.value)}<br /> {/foreach} {/if} This shipping cost is for display purposes only. CubeCart will make proper shipping calculations when the customer begins to checkout. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 7, 2014 Share Posted August 7, 2014 There is actually more work to do with the code in the template. The By Weight module returns a package of two methods, but the code is only showing the 0-th method. More shortly. Quote Link to comment Share on other sites More sharing options...
kenhar Posted August 8, 2014 Author Share Posted August 8, 2014 thank's Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 8, 2014 Share Posted August 8, 2014 From the above code to add to the template:{if $PRODUCT.shipArray} {foreach $PRODUCT.shipArray as $shipper => $package} {$shipper}: {TAX::getInstance()->priceFormat($package.0.value)}<br /> {/foreach} {/if} We will break out the various methods of the package: {if $PRODUCT.shipArray} {foreach $PRODUCT.shipArray as $shipper => $package} {$shipper}: {foreach $package as $method}{$method.name} TAX::getInstance()->priceFormat($method.value)}<br /> {/foreach} {/foreach} {/if} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.