Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About John_A

  • Rank
    Regular Member

Profile Information

  • Gender
    Not Telling
  1. Thanks both for your input. As I said, it was a bespoke shopping cart script, that I inherited, which already had a Google feed but the sizes were in a comma separated list for each product (used to be OK with Google) but now needs to be one size per product. I wrote neither the initial script nor the google feed add-on. I've been tasked with this, and not a lot of time to do it. I'm already working on a local dev server, not the live site. TBH it would have taken me longer to do everything you suggest to ask the question "properly" than it did for me to fix it myself. I didn't explo
  2. OK, thanks for your help so far. Partially thanks to your input I changed my approach completely, now manipulating the feed as I create it line by line later in the same file, rather than messing with the array beforehand, and have it working just as I need. Hopefully, one day, I'll be as awesome as you and not need to ask for help. Stay safe, and thanks again!
  3. Going through the array for sizes was messing with the feed output later on, so I changed it to a foreach instead. The plan is for the first foreach loop to manipulate the product array as necessary, then once done a separate foreach going through the now correct array to output the feed. Here's the one I need to fix: - foreach ($result as $key => $thisProduct) { echo $thisProduct["prodID"] . '<br/>'; $thisproductSizes = ""; $sizesResult = $dbA->query("SELECT $ExtraFieldsValues.content From $ExtraFields, $ExtraFieldsValues Where $ExtraFields.name = 'size' and $ExtraF
  4. There probably is but it's for an automatic google product feed that will run once every month so efficiency isn't really a concern. It's part of a bespoke ecommerce script I inherited and can't really change much on, the table structures are what they are and can't be changed at this stage. So what I have is the $products array which includes most of the fields I need straight out of it, but the sizes needs to be a 2nd query within that. The $product array should be updated on-the-fly with duplicates where necessary with only one size in each, and the id and item group id updated to
  5. It turns out I don't actually have the sizes in the $product array as above, they're a query within the loop that builds the feed in it's current state. $result is the query to fetch all products... $count = $dbA->count($result); for ($f = 0; $f < $count; $f++) { $record = $dbA->fetch($result); $productSizes = ""; $result2 = $dbA->query("SELECT $ExtraFieldsValues.content From $ExtraFields, $ExtraFieldsValues Where $ExtraFields.name = 'size' and $ExtraFields.extraFieldID = $ExtraFieldsValues.extraFieldID and $ExtraFieldsValues.prodID =".$record["prodID"]." Orde
  6. I have an existing PHP array ($products) with various fields in it.... id / title / description / link / image link etc. etc. as per requirements for a Google Products feed (https://support.google.com/merchants/answer/7052112). My issue is that, for clothing, Google want a separate record for each size available. My array includes the "size" field as a comma separated list e.g. 6,8,10,12,14 or XS,S,M,L,XL etc. etc. So before creating the feed (a text file, which is currently outputting fine except for the size field issue) I need to duplicate each id where there's more than 1 size in
  7. Nothing, everything is the same there are just slight differences in the way things are done sometimes, e.g. parsing xml as php the syntax is slightly different in .htaccess due to PHP setups differing slightly. 99.9% of the time everything is identical, but there are sometimes a few lines in a .htaccess file somewhere that just have to differ. I'm perfectly happy with the hosting I have, I pay for a managed service and it was actually myself who asked for Litespeed on the one in question, initially when it was touted as a faster, drop-in replacement for Apache but it's now evident that t
  8. OK, here's the background... I used to use an environment variable to enable me to differentiate between my dev and production server, using this in .htaccess: - <IfDefine DEV_SERVER> # dev server specific stuff here </IfDefine> <IfDefine !DEV_SERVER> # production server specific stuff here </IfDefine> The environment variable "DEV_SERVER" was only ever set on my dev server, and never on production, obviously. This approach worked a treat until my production server host installed Litespeed as a replacement for Apache. Litespeed doesn't like the ab
  9. Wow, if that works then that's excellent, thanks a lot! I'll backup all just in case!
  10. I've got a dev server which, for reasons I won't go into, needs to have different .htaccess files for each site (and subfolders within them) within it. But not always. What I need to do is: - For the folder I put the PHP script in, and every folder under it (the whole tree under it): - If there's a .htaccess file an no .htaccess.dev file, copy .htaccess and name the copy .htaccess.dev (and look in subfolders) If there's a .htaccess file and also a .htaccess.dev file, do nothing (but keep looking for subfolders) If there's neither a .htaccess or .htaccess.dev file, d
  11. Thank-you both! I went with option #2, as it seemed the most straightforward. Worked perfectly
  12. I have a file in the same location as my PHP file, say test.txt, and in multiple locations it has content like: - href="http://www.domain.com/entry.php/256/1/this-is-the-title" or href="http://www.domain.com/entry.php/123/2/another-title" which I need replaced within the file to: - href="{EntryNumber=256.link}" and href="{EntryNumber=123.link}" Only the first number is needed for the replacement, it will be between 1 and 999. Everything between the 5th / and the 2nd " can be safely ignored and removed. This is not the only content in the line, and sometimes there may be more than one
  13. Thanks again. It's part of a URL building function...to replace any non-alphanumeric characters with spaces, which are in turn replaced with dashes or underscores in the next part...
  14. Thanks for your reply Jacques1. I did check the manual before posting, and it says to use preg_replace_callback() instead. But if, as you say, the modifier in my code does nothing anyway, is my suggestion (i.e. to simply remove it) not the best approach in this case?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.