You are here:  » seperate pages for categories


seperate pages for categories

Submitted by paullas on Mon, 2020-11-16 20:12 in

Hi David.

I hope all is well.

I am revisiting my site {link saved} and would like to add specific category pages, for example i want to create a page called Computers then add some content on the page and display computers from the database.

One question is how would i go about creating this page and how would i get it to show certain products on the page randomly, say from a specific keyword of phrase.

Also how would i add the new pages in the top menu of the website.

Oh and also any ideas how i can speed to site up as it is taking a while to display products when i am doing a search.

Many thanks

Paul

Submitted by support on Tue, 2020-11-17 07:58

Hi Paul,

Sure - first start by making a copy of search.php and save it as searchcode.php.

Now edit the new file and first delete line 2:

  require_once("includes/common.php");

And then delete all the output code beginning with the following code at line 539:

  require("html/header.php");

...all the way to the end of the file, leaving just the closing PHP tag at the end.

So to make your Computers page, make a copy of example.php saved as computers.php.

First, edit the title and meta keywords and description at lines 4-8 and the breadcrumbs at line 18.

Then at line 27 you will see a <p> element containing the placeholder text. Replace this with a PHP section as follows:

<?php
  $_GET
["q"] = "category:Computers:";
  require(
"searchcode.php");
  require(
"html/searchresults.php");
?>

To add a drop down menu for this and another page, for example televisions.php, edit html/menu.php and look for the following code at line 41:

      </ul>

...and REPLACE with:

        <li class="has-dropdown">
          <a href="#">Articles</a>
          <ul class="dropdown">
            <li><a href="/computers.php">Computers</a></li>
            <li><a href="/televisions.php">Televisions</a></li>
          </ul>
        </li>
      </ul>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Tue, 2020-11-17 09:12

Hi David

excellent thank you, i will give this a go today.

I have another issue, for some reason products are not being downloaded with products. I am not sure if i have asked this before so apologies. Do you have any ideas why the images are not displaying for example: {link saved}

do you think the server is blocking them.

Also any ideas why the site is slow, should i setup a vps as i have so many products.

thanks

Paul

Submitted by support on Tue, 2020-11-17 09:23

Hello Paul,

I notice you're using imageCache.php for the product images; this could be the SSL verification issue (see this comment) as a result of your server's SSL implementation not having the necessary authority certificates to verify the connection; or less likely a user-agent issue (see this comment) where the server is blocking requests that don't appear to be browser originated...

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Wed, 2020-11-18 21:23

Hi David

Getting there i think.

ok i made the following page:

{link saved}

Can you see under the search i have put the words Computer Desks, I am going to put a paragraph of describing Computer Desks which will be about 350 words so i am looking at putting this above the products but formatting it so it looks good. can you help on this please.

Also it is only showing 18 products but the computer desk category has alot more, so how do i get it to show 15 then have the next page underneath to view all the products in the computer desk category.

Submitted by paullas on Wed, 2020-11-18 21:30

Also (sorry)

If you look at this for example:

{link saved}

You can display the products grid view or line by line, is there a way to make the whole site default line by line as i think this looks better than grid view where it shows 3 products on each line.

thanks again

Paul

Submitted by paullas on Thu, 2020-11-19 13:55

Hi David.

Is it possible to randomly display a google adsence add in place of products? for example if i am shoing 18 products on the front page to randomly replace 2 products with an adsence ad.

thanks

Paul

Submitted by support on Thu, 2020-11-19 14:24

Hi Paul,

Regarding your unique content; as your template uses the Bootstrap framework in order to align the text with the rest of the layout I think you want to enclose the <p>...</p> within a full width row so I think this would be something like:

<div class='row'>
  <div class='col-sm-12'>
    <p>Your unique content here...</p>
  </div>
</div>

Regarding the search results layout, check your template config for a default setting for grid or list.

Regarding inserting advertising into search results, have a look in your html/searchresults.php for the opening foreach() statement that loops over the search results:

    <?php foreach($searchresults["products"] as $product): ?>

...and REPLACE with:

    <?php foreach($searchresults["products"] as $k => $product): ?>
    <?php if ( ($k==6) || ($k==12) ): ?>
      ...insert your advertising HTML here...
    <?php endif; ?>

That would display the advertising HTML after the 6th and 12th results ($k is zero based). As with your custom content, enclose the code within a bootstrap full width row, or as required to work with your search results layout...

Hope this points you in the right direction!

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Thu, 2020-11-19 21:07

Hi David

I tried the above code as you can see here {link save}

but as you can see it isnt wrapping it correctly.

Is there anyway it just replaces a product that way it looks seamless.

thanks

Paul

Submitted by support on Fri, 2020-11-20 07:27

Hi Paul,

I think the main problem in grid view is the fixed size ad being larger than the product images. As the design is responsive you really want to be using a responsive advertising code block (which Google Adsense supports) and it will fill the space with an appropriately sized creative - and should also allow for a larger ad in list view...

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Sat, 2020-11-21 13:23

Hi David.

Sorry to reply but still having issues with images not loading as you can see here {link saved}

do you think it is a vps server issue or code issue.

thanks

Paul

Submitted by paullas on Sat, 2020-11-21 17:58

Hi David

I have made the page {link saved}

but it is only showing 18 products, can i ask how do i make it show a 5 in a row and also show 5 colums and then a page next to view more.

thanks

Paul

Submitted by support on Mon, 2020-11-23 09:33

Hi Paul,

Image loading is looking OK now and it also looks like you now have 5 results per page working but let me know if any outstanding problems. To add the navigation, in your custom page where you have added the call to html/searchresults.php:

  require("html/searchresults.php");

...REPLACE with:

  require("html/searchresults.php");
  if (isset($navigation)) require("html/navigation.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Thu, 2020-11-26 12:19

Hi David

I have now got accepted on google ads on my site but when i add the above code it is putting the adsence code above the products?

any ideas.

thanks

Paul

Submitted by support on Fri, 2020-11-27 08:28

Hi Paul,

You might need to make sure that the Adsense code is enclosed by the same markup that encloses each product - look at the HTML generated at the beginning and end of the inside of the foreach loop, for example you may need to use:

<div class='row'>
  <div class='col-sm-12'>
    ...your Adsense code here...
  </div>
</div>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Sat, 2020-11-28 11:00

Hi David

Dont know if i am doing it wrong but here is my code and still not working

URL: {link saved}

Submitted by support on Mon, 2020-11-30 08:29

Hi Paul,

All it is, as you've moved to a table layout the Adsense code needs to be contained within a table cell instead of the div/rows markup; so instead of:

<div class='row'>
  <div class='col-sm-12'>
    ...your Adsense code here...
  </div>
</div>

...now use:

<td valign='top' align='center' width='<?php print intval(100/$columns); ?>%'>
  ...your Adsense code here...
</td>

Cheers,
David.
--
PriceTapestry.com