Forums / All Other Contributions/Addons / Related Products 1.5

Related Products 1.5

Started by dharrison on 19 Aug 2019, 10:24 AM · Views: 1,056

Results 1 to 10 of 10
19 Aug 2019, 10:24 AM
#1
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Related Products 1.5

Hi

I am using https://www.zen-cart.com/downloads.php?do=file&id=1065 on my website and so far it looks great. However on one page I have only 2 related products to add https://shaftdirect.com/office-seating-c-87_64/flexiback-visitors-chair-p-112.html

The width are set to 50% as default but this results in the products showing vertically instead of horizontally. I have tried to locate any margin or padding and nothing seems to work.

When I set the width to 49% it appears how it should.

Please could anyone advise how I can override this issue? For example if theres 2 columns set the width to 49% not 50%?

I welcome any help.

Kind regards

Debbie Harrison
DVH Design | Web Design blog

20 Aug 2019, 9:39 AM
#2
raptar avatar

raptar

New Zenner

Join Date:
Jan 2019
Location:
New Zealand
Posts:
38
Plugin Contributions:
0

Re: Related Products 1.5

Hi dharrison,
Have you tried to change the styleshet.css ```html
.centerBoxContentsRelatedProduct{float:left;}

Regards raptar
20 Aug 2019, 12:36 PM
#3
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Related Products 1.5

Thanks @raptar. That does remedy the issue. However now I have this issue: https://shaftdirect.com/the-deluxe-manual-sitstand-desk-c-85_134_137/manual-crank-deluxe-sit-to-standing-adjustable-desk-express-p-38.html

If I could just adjust the width in this case then it should work. 3 columns is set to 33% so I have no issue there.

Debbie Harrison
DVH Design | Web Design blog

20 Aug 2019, 4:34 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Related Products 1.5

In includes/modules/related_products.php, if you add the $col_width assignment just below the existing assignment for both cases (the first around line 43), it seems as if you may get the desired results:

if ($num_products_count == 2) {
  $col_width = 49;
}

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

20 Aug 2019, 4:59 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Related Products 1.5

FYI, when I went to the page of the most recent product, there was a mixed content notification. Suggest resolving that in addition to whatever you're working on.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

20 Aug 2019, 5:01 PM
#6
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Related Products 1.5

Thanks mc

I tried that

// show only when 1 or more
if ($num_products_count > 0) {
  if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 0) {
    $col_width = floor(100/$num_products_count);

[B]if ($num_products_count == 2) {
  $col_width = 49;
}[/B]
	
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS);
  }
  while (!$featured_products->EOF) {

But no joy.

When you say "Mixed content" what do you mean? I haven't seen that :blink:

Debbie Harrison
DVH Design | Web Design blog

20 Aug 2019, 6:28 PM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Related Products 1.5

dharrison:

Thanks mc

I tried that

// show only when 1 or more
if ($num_products_count > 0) {
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 0) {
$col_width = floor(100/$num_products_count);

[B]if ($num_products_count == 2) {
$col_width = 49;
}[/B]

} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS);
}
while (!$featured_products->EOF) {

> 
> But no joy.
> 
> When you say "Mixed content" what do you mean?  I haven't seen that :blink:

What's the value of SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS?

Mixed content, displaying/linking to https: type items while also doing so to http: type items. Like script source code accessing http: while other script code referencing http:.

For example, the following is specifically causing this plus any others that might be on the page:
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript"></script>

On the issue of the previous file, did it get installed into the template override folder?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

20 Aug 2019, 11:47 PM
#8
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Related Products 1.5

Hi mc

What's the value of SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS?

3 which is the default. so is the SHOW_PRODUCT_INFO_COLUMNS_RELATED_PRODUCTS

For example, the following is specifically causing this plus any others that might be on the page:
Code:

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript"></script>

OK I have changed this to https://. But only really saw this as a potential issue. http is referencing other sites in a few cases of my code but I cannot see how this would have any affect on the rest of my code. Plus not all websites are https:// yet.

I have tried the code again and using https://shaftdirect.com/office-seating-c-87_64/flexiback-clerical-chair-p-110.html as an example, it hasn't worked.

Debbie Harrison
DVH Design | Web Design blog

21 Aug 2019, 2:14 AM
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Related Products 1.5

dharrison:

Thanks mc

I tried that

// show only when 1 or more
if ($num_products_count > 0) {
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 0) {
$col_width = floor(100/$num_products_count);

[B]if ($num_products_count == 2) {
$col_width = 49;
}[/B]

} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS);
}
while (!$featured_products->EOF) {

> 
> But no joy.
> 
> When you say "Mixed content" what do you mean?  I haven't seen that :blink:

There is still something "not right" here... I am looking at the code that is provided with the module and looking at the result on the site.  With the above suggested code, given that SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 3, $num_products_count == 2, this means that the first section of the if statement is expected to be followed and therefore initially $col_width would be set to 50.  But, then because $num_products_count == 2, the next inner code is expected to be executed which sets $col_width == 49.  There is no code that follows modifying $col_width therefore when the html is assembled for the product the width:49% should be applied.

This brings me back to the question of if includes/modules/winchester_responsive/related_products.php exists.  If it does, then the change recommended above about using the if ($num_products_count == 2) … should be applied to that file.  Otherwise, verify that the file has been saved and/or that it is not write protected in trying to save it.

> **dharrison:**
>
> Hi mc
> 
> 
> 
> 3 which is the default.  so is the SHOW_PRODUCT_INFO_COLUMNS_RELATED_PRODUCTS
> 
> 
> 
> OK I have changed this to https://.  But only really saw this as a potential issue. http is referencing other sites in a few cases of my code but I cannot see how this would have any affect on the rest of my code.  Plus not all websites are https:// yet.
> 
> I have tried the code again and using <https://shaftdirect.com/office-seating-c-87_64/flexiback-clerical-chair-p-110.html> as an example, it hasn't worked.
There are some "nuances" about what can/can not begin with http:  For example a straight out clickable link, depending on the browser, could begin with http:, but an image or a script's "src=" should not be different than the presented page.  Some ways around the "concern" of one or the other includes using no prefix and just beginning with the double forward slash followed by the domain name and remainder of the address, otherwise to use say $request_type to identify whether it should begin with https: or http: respectfully (if $request_type == 'SSL' then https: should be used otherwise http:).

Anyways, I also now see that there are 2 console issues identified when using Microsoft Edge and that there appear to be four unmatched end tags which could play a factor in how things are displayed (ie. could be the cause of your problem and all this "math" stuff may not be necessary.

Suggest running the page through an HTML validator in some way or fashion to be sure that the template and page are formatted correctly and then work on the display issues.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

21 Aug 2019, 4:16 AM
#10
raptar avatar

raptar

New Zenner

Join Date:
Jan 2019
Location:
New Zealand
Posts:
38
Plugin Contributions:
0

Re: Related Products 1.5

Try changing html .centerBoxContentsRelatedProduct { display: inline-block;} to ```html
.centerBoxContentsRelatedProduct {display: inline-table;}