Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

modding up a 2.3.4BS Gold


greasemonkey

Recommended Posts

Ok, discount codes are done.... However, having some trouble getting the javascript to validate the code to work... below is the scrip - that in standard OsC versions goes in checkout_payment. I didn't think it would work... and it doesn't. Any ideas would be greatly appreciated????

 

I think it needs to go in includes/template_bottom.php but no joy...

<?php
  // Discount Code 3.1.1 - start
  if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?><script>
$(document).ready(function() {
var a = 0;
discount_code_process();
$('#discount_code').blur(function() { if (a == 0) discount_code_process(); a = 0 });
$("#discount_code").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } });
function discount_code_process() { if ($("#discount_code").val() != "") { $("#discount_code").attr("readonly", "readonly"); $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_progress.gif'); ?>'); $.post("discount_code.php", { discount_code: $("#discount_code").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_success.gif'); ?>') : $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_failed.gif'); ?>'); $("#discount_code").removeAttr("readonly") }); } }
});</script>
<?php
  }
  // Discount Code 3.1.1 - end
?>

The coupon code seems to work in testing - just not giving the "green check" "red x"....

 

Also had to redo the input fields from tables to divs... Like this;

        <label for="inputComments" class="control-label col-sm-4"><?php echo TEXT_DISCOUNT_CODE; ?></label>
		<div class="col-sm-8">
		<?php 
		echo '  '.tep_draw_input_field('discount_code', $sess_discount_code, 'id="discount_code" size="10"'); 
		?>
	   </div>
Link to comment
Share on other sites

  • Replies 146
  • Created
  • Last Reply

Testing is going well... But up comes a long outstanding issue. That I documented here.

 

PayPal Express does not set the shipping rate selected in checkout_shipping. It reverts back to this is logic;

                  $shipping = $shipping_modules->cheapest();

From what I can tell PayPal Express does not have the logic to set the shipping method selected at checkout_shipping with instant update turned off.

 

This only thing I can find is to set the shipping method from the PayPal order review page - which only shows with instant update turned ON?

              if ( (OSCOM_APP_PAYPAL_GATEWAY == '1') && (OSCOM_APP_PAYPAL_EC_INSTANT_UPDATE == '1') && ((OSCOM_APP_PAYPAL_EC_STATUS == '0') || ((OSCOM_APP_PAYPAL_EC_STATUS == '1') && (ENABLE_SSL == true))) && (OSCOM_APP_PAYPAL_EC_CHECKOUT_FLOW == '0') ) { // Live server requires SSL to be enabled
// if available, set the selected shipping rate from PayPals order review page
                if (isset($appPayPalEcResult['SHIPPINGOPTIONNAME']) && isset($appPayPalEcResult['SHIPPINGOPTIONAMOUNT'])) {
                  foreach ($quotes as $quote) {
                    if (!isset($quote['error'])) {
                      foreach ($quote['methods'] as $rate) {
                        if ($appPayPalEcResult['SHIPPINGOPTIONNAME'] == trim($quote['module'] . ' ' . $rate['title'])) {
                          $shipping_rate = $paypal_express->_app->formatCurrencyRaw($rate['cost'] + tep_calculate_tax($rate['cost'], $quote['tax']));

                          if ($appPayPalEcResult['SHIPPINGOPTIONAMOUNT'] == $shipping_rate) {
                            $shipping = $quote['id'] . '_' . $rate['id'];
                            $shipping_set = true;
                            break 2;
                          }
                        }
                      }
                    }
                  }
                }
              }

Please someone tell me I'm wrong (and show me where...lol) - where is shipping set with instant update turned OFF?

Link to comment
Share on other sites

Hi All, work continues, despite the PayPal issues...

 

As mentioned before - I installed the shipping quotes in cart... Works well. May need a little de-bugging. But I will test more later and move these discussions to the support forum.

 

Also installed All Products SEO from here @@Jack_mcs. Although he hasn't produced a BS version it wasn't "too" hard to bootstrap it. Needs a little more testing (haven't tried the price_list yet....).

 

And a note to others (more myself....Lol) when adding modules that use product_listing.... don't forget to add them to header tag modules Equal heights & Grid List.

Link to comment
Share on other sites

Starting to work on some backend stuff - that makes my shop run smooth.

 

1) master password - HERE . Great tool for when customers get 'stuck' in the checkout process... And or, mostly, we use it for phone orders. Just login (or create a account) and follow the checkout....

 

2) A mod loosely based on THIS, (we are based in Canada) so my US customers land on our site in USD. The rest of the world lands on our site in CAD. I've modified it to use the built in IP county lookup in my CDN - Cloudflare. The free wipmania.com api was a little inconsistent.

Link to comment
Share on other sites

Something to try for the discount codes - I can't promise anything, though! Your page isn't throwing any errors but the function doesn't seem to get invoked. The jQuery search term on the field id looks ok and I can't see any duplicate ids. Maybe making $ explicitly the jQuery object will help... instead of

$(document).ready(function() { /* discount code stuff */ });

try

jQuery(function($) { /* discount code stuff */ })(jQuery);

- note that's got jQuery on both ends.

If that still doesn't help, try reformatting the whole discount code script so that it's got a line for each statement and condition which will make debugging easier!

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn Looks to be something more complicated... But is well above my pay grade. I'll move this to the support thread here

 

And for todays mods....

 

A little more backend stuff. A custom code to update prices, inventory and taxes (and a few other fields) from a .txt export from Quickbooks. I've been using this for years and will continue... 1 file in the admin and couple small additions to admin/includes/boxes... etc...

 

And on the frontend.... I hacked up THIS addon into create_account.php to  auto fill the state/province and country fields. This has worked very well for me for the past year. Much better than the dhtml state selector (I often had customer create accounts with the "first" state/province in the selection... only to have issues shipping).

 

I didn't use the auto fill for city or zip/postal code - I feel this may "cross" a weird line... "how does this site know where I am kinda thing - if that makes sense".

 

There was a fair amount of work (for an amateur like myself) to bootstrap the country field.

Link to comment
Share on other sites

Hi All, we are getting VERY close.... Lots of work over the past day and a half.

 

Apple Touch icon header tag module - no core changes... took 30 seconds to install... Not sure where this came from orginall (sorry if I didn`t credit the author).

 

Batch printing without pdf here - been using this since I upgraded from php 5.2 (I use to use batch print center with PDF and it worked well but has lots of old code no longer compatible with php 5.3 and above). We process between 20 and 120 orders a day... this is a critical addon. And is much easier to install (also missing many features) then some other order handling addons. And its all i require.

 

Orders at a glance... here. I have no idea why this was removed from the core (a long time ago... from 2.2 to 2.3).

 

Database optimizer... here.... We`ve been running this store since May 2009 - and the db is just under 100mb. This keeps it running smooth. Optimizes every night, and truncates some of the older session data via cron

 

And database auto backup .... here... There is an updated version for 2.3.3.2 (mysqli) and above in the support forum here. Again I run this via cron every 12 hours. This addon works.... But requires attention when restoring. Check the support forum for details.

 

I`m now at the point where I need to look at the last and largest addon - SPPC with QPBPC. I`ve installed this addon 3 times... So I have some experience but its a big one. I expect issues in the new product listing so wish me luck!

Link to comment
Share on other sites

  • 3 weeks later...

Hi All, I haven't been working on this project for the past week as things settle down operationally.  Its difficult as a small business owner (its just me and my wife plus 8 employees) and I've just fired our manager - so there's been a lot on my plate.

 

I'm still; baby sitter, tech support (both physical network and online), customer service, accounting, sales, R&D.... so the web development team (oh.... that's me too) has had to put this on the back burner for a while.
 

I still need to do SPPC - I hope to start that in the next week.

 

Couple small issues I've been dealing with today - which I had mentioned before HERE (in post #52). PayPal express does not (seems not) to have the logic, with instant update turned off, to carry forward the customers shipping selection from checkout_shipping. With instant update off PP express will always (again seems to always)  use;

              if ($shipping_set == false) {
                if ( method_exists($shipping_modules, 'get_first') ) { // select first shipping method
                  $shipping = $shipping_modules->get_first();
                } else { // select cheapest shipping method
                  $shipping = $shipping_modules->cheapest();
                }

And for me it will not seem to use 'get_first' -- it always falls back to 'cheapest'.

 

So, as an (not ideal) alternative, I've used similar code @@Harald Ponce de Leon suggested HERE to send my customers back to checkout_shipping to "reselect" their shipping method - then skip checkout_payment to checkout_confirmation. So, when a customer is logged in and is using PayPal Express as their payment method they see checkout_shipping twice. When not logged in and using the Checkout with PayPal button I'm fine with the logic of using the cheapest method.

 

In /ext/modules/payment/paypal/express.php I've changed lines around 642 to;

		//added to send customer back to checkout_shipping
          tep_session_register('appPayPalEcRightTurn');
          $appPayPalEcRightTurn = true;
		  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
		  //tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
Link to comment
Share on other sites

Hi again all, I have tested my above PayPal fix and moved it to my live store - it worked so well. As I said, its not ideal, but is the best of all worlds - until the logic to include shipping with instant update off and or instant update works; 1) with PayPal's mobile site and 2) I can figure out the bugs (SSL related - with instant update on) with the Checkout with PayPal button and shipping.

 

So, the good news... I've completed step 1 of the SPPC install - going straight from the old 2.2 copy & paste instructions (I must say these original instructions written my @Jan Zonjee have to be the most thorough instructions ever written... I'm very grateful)  and comparing files at the same time to my live 2.3.4 store.

 

Step 2 will be updating this install to work with QPBBC. Wish me luck... I wont start working on this for at least a couple days....

Link to comment
Share on other sites

Hi all, I have "completed" step 2 of SPPC - integrating Quantity Price Breaks. Notice the " ".... It was challenging (for someone of my skill level).

 

When I look back - the vast majority of the admin, and many of the class and function files haven't changed much (or enough) to pose to many issues - that and my grasp of the basic coding logic in OsC is MUCH better than the last time I installed SPPC/QPBPC (about 2 or 3 years ago). However, I have struggled through the catalog files but now have the product_listing, new_product modules as well and product_info working well. I haven't touch specials yet... But should be able to get it working...

 

I still have LOTS of work to do...

 

I have reworked the priceformatter tables using resources found HERE, HERE and also HERE to be responsive.

 

Again, I'm  still far away from calling it complete... I have a lot of debugging to do and I'm still working on styling the product_info table to fall gracefully on all devices... So far, however, I'm pleased.

 

I have attached some thumbnails for your viewing pleasure :D :D

 

post-270094-0-51831300-1431180188_thumb.jpg post-270094-0-74476600-1431180192_thumb.jpg post-270094-0-22354100-1431180199_thumb.jpg

Link to comment
Share on other sites

Bravo - looks good!

 

We just made the decision not to bother with QPBPP in the current rebuild as out of the hundred or so implemented in the store, we can't remember anyone buying enough to get the discount! It's not as though we're short of other things to do ;)

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Some troubleshooting/debugging done. I noticed the product description was missing from the product_listing module.

 

Built from this line;

    $prod_list_contents .= '      <p class="group inner list-group-item-text">' . strip_tags($listing['products_description'], '<br>') . '…</p><div class="clearfix"></div>';

After racking mine brain for several hours I see now the $listing_sql query is actually built in index.php and had been edited with SPPC (from 2.2 when product description probably wasn't part of the product listing module...) and was now missing pd.products_description. Fixed below...

	$listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd , " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";		
	} else { // either retail or no need to get correct special prices -- changed for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
	} // end else { // either retail...
// EOF Separate Pricing Per Customer
      } else {
// We show them all
// BOF Separate Pricing Per Customer
        if ($status_product_prices_table == true) { // ok in mysql 5
        $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";	
	} else { // either retail or no need to get correct special prices -- changed for mysql 5
        $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
	} // end else { // either retail...
// EOF Separate Pricing Per Customer
      }
    } else {
// show the products in a given categorie
      if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory;  
// BOF Separate Pricing Per Customer
        if ($status_product_prices_table == true) { // ok for mysql 5
        $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";	
        } else { // either retail or no need to get correct special prices -- ok in mysql 5
        $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id) where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
        } // end else { // either retail...
// EOF Separate Pricing Per Customer
      } else {
// We show them all
// BOF Separate Pricing Per Customer --last query changed for mysql 5 compatibility
        if ($status_product_prices_table == true) {
	// original, no need to change for mysql 5
	$listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
        } else { // either retail or no need to get correct special prices -- changed for mysql 5
        $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; 
      } // end else { // either retail...
// EOF Separate Pricing per Customer

      }
    }
Link to comment
Share on other sites

The debugging continues with the price break tables - trying to make them "more" responsive for when more than 2 price breaks are used by adding;

/*BOF table wrapping*/
.table-wrapping {
    table-layout: fixed;
    word-wrap: break-word;
}	

Here's a screen shot from an iphone... post-270094-0-32710000-1431371785_thumb.png

Link to comment
Share on other sites

Great stuff, Scott. The tables seem to behave themselves very well.

 

There's a wriggly spot for the description and stock/buy bits, though, around small tablet size, where the content div pokes its head up into the header div (firefox on windows desktop)... see attached

 

post-220375-0-28202000-1431374872_thumb.jpg

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn Thanks very much for the feedback John, I hadn't tested it on tablets.... Good news is I'm starting to understand bootstrap better - and how the classes scale up.

 

Now I just need to figure out the clearfix thing... so I can get rid of some of my special css padding (see page-header2).

 

I've reworked the product_info page to the below... it now falls into place much better;

<div class="page-header2">
<div class="col-sm-6  text-left"><div class="h1price"itemprop="offers" itemscope itemtype="http://schema.org/Offer"><?php echo $products_price; ?></div></div>
<div class="col-sm-6  text-right">
<?php
// BOF: MOD - EASY CALL FOR PRICE 2.3.1v1.0
    if ($product_info['products_price'] == CALL_FOR_PRICE_VALUE){
?>
    <span class="buttonAction">
    <?php 
	  $back = sizeof($navigation->path)-2;
      if (isset($navigation->path[$back])) {
		echo tep_draw_button(IMAGE_BUTTON_BACK, 'glyphicon glyphicon-chevron-left', tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode'])); 
	  }
	  ?></span>
<?php
} else {
?>
       <span class="buttonAction"><?php echo tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="3" style="vertical-align:middle', 'tel').' '. tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'glyphicon glyphicon-shopping-cart', null, 'primary', null, 'btn-success'); ?></br></span>
	   <?php
}
// EOF: MOD - EASY CALL FOR PRICE 2.3.1v1.0
?>
</div>
<div class="col-sm-6 instock text-right">
    <?php 
	if($product_info['products_quantity'] <= 0) {
      echo '<a class="pull-right" href="' . tep_href_link(FILENAME_SHIPPING) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . 'icons/outofstock.png', "Out of Stock", 87, 25) . '</a>';
    } else {
      echo '<a class="pull-right" href="' . tep_href_link(FILENAME_SHIPPING) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . 'icons/instock.png', "In Stock", 139, 32) . '</a>';
    }
?>
	  </div>
</div>
Link to comment
Share on other sites

 

I haven't touch specials yet... But should be able to get it working...

 

Struggled mightily with specials.php.... But I won (w00t) (w00t) (w00t) (w00t) (w00t) (w00t)

 

I think (hope) I'm almost done debugging this puppy...

 

With 2 VERY simple change thanks to whoever was the smart guy to integrate with the product listing - all I had to add was the customer group to the listing query...and the SPPC global variable.

<?php
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
    $customer_group_id = $_SESSION['sppc_customer_group_id'];
  } else {
    $customer_group_id = '0';
  }
?>
  $listing_sql = "select " . $select_column_list . " p.products_id, SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = '" . (int)$customer_group_id . "'";
Link to comment
Share on other sites

 

...thanks to whoever was the smart guy to integrate with the product listing...

 

If I remember right that was burt that implemented that. He did create it for the old 2.3.3.4 but it was buried somewhere in a topic. But finally resurrected again in osC BS

Same goes for the products_new.php, just a query and the rest is inside the product listing file.

Link to comment
Share on other sites

Ok query experts.... Hopefully someone can help me out with this one.
 

I'm debugging catalog/products_new.php and I'm stuck... The issue I have with is with SPPC and Specials.

 

If I have more than 1 special on the same product in multiple customer groups (special for retail $2.00 and special for wholesale $1.00), on the products_new.php page the product is duplicated for each special (group).

 

The price is correct in each price group.... its just repeats for each special (if I had 10 customer groups and put it on sale in each customer group it would show 10 times)... Make sense????

 

I've added the global customer group variable - and the customer group is being set....

<?php
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
    $customer_group_id = $_SESSION['sppc_customer_group_id'];
  } else {
    $customer_group_id = '0';
  }
?>

I'm working with this query on catalog/products_new.php to see if I can limit the specials to only show for the customer group session;

  $listing_sql = "select " . $select_column_list . " p.products_id, 
    SUBSTRING_INDEX(pd.products_description, ' ', 20) as products_description, 
	p.manufacturers_id, 
	p.products_price, 
	p.products_tax_class_id, 
	IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 
	IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . 
	TABLE_PRODUCTS_DESCRIPTION . " pd, " . 
	TABLE_PRODUCTS . " p left join " . 
	TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . 
	TABLE_SPECIALS . " s on p.products_id = s.products_id 
	where p.products_status = '1' 
	and p.products_id = pd.products_id 
	and pd.language_id = '" . (int)$languages_id . "'
";

I've tried adding the condition;

	and s.customers_group_id = '" .$customer_group_id. "'

But that filters the result to ONLY the specials for that customer group.

 

I want ALL (new) products and specials for ONLY the customer group.

 

I've attached a thumbnail for reference....

 

post-270094-0-29430900-1431646014_thumb.jpg

Link to comment
Share on other sites

You'll need to do some testing of this on a copy of your live data (when you've got it working) because there's a risk these queries could end up being quite slow at production volumes... is it possible to have two separate queries - a straightforward one and one for when the group is set; that way you won't get trouble with spiders either?

 

Anyway, one way to get what you need is a left join to a subselect of specials for that customer group... left join (select status, specials_new_products_price from specials where customers_group_id = '" .$customer_group_id. "') s on s.products_id = p.products_id

 

This will be quicker if you filter the specials subselect so it only pulls out active specials, but it will still pull out all the matching specials for each product returned by the main query, which could end up being a lot of rows.

 

If it's too slow, the alternative would be to ignore the extra rows when you're displaying them. If the data currently shows correctly but once for each special for whichever group, you must already be testing if the specials apply to the right group. You could roll up duplicate rows checking if there's a relevant special. Ugly but probably less overhead than the other way, depending on how the numbers compare. Try the query first and see how it runs.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

While we're on this topic, be really careful what you do with search and advanced search - you can bring the whole site to a grinding halt with mods like SPPC and multiple specials in the queries there.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Afterthought... I remember SPPC being a really well-written and documented addon, so it probably has caching written for it. If you cache these pages per customer group you shouldn't need to worry about the performance of the query as it won't get run too often unless you spend all day every day changing specials!

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn THANK YOU so much for your thoughts John. they are greatly appreciated. I haven't loaded my products database yet - so very good point (we have over 2600 sku's and growing) about production data.

 

I will play with the subselect to see if I can get it working.

 

As a worst case (if I feel it may hold me back from going live) I may consider remove specials completely from the products_new.php query.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...