Jump to content

ricmetal

Members
  • Posts

    351
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://adf.ly/Tn1MQ

Profile Information

  • Gender
    Male
  • Location
    Portugal

ricmetal's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. hi yes, thanks i added p.external_url to the top line @ $query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, p.external_url, m.name AS manufacturer, and added the external_url variable in the array: return array( 'product_id' => $query->row['product_id'], 'external_url' => $query->row['external_url'], however, i managed to get the data to show today. turns out i was outputting the wrong variable name (the variable which had the data in the array above) thanks!
  2. hi guys im looking into making a little modification to my open cart store but i need help cause im not fluent in advanced sql queries... the line i need changed is the following: $query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$customer_group_id . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$customer_group_id . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$customer_group_id . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"); i need to retrieve the column 'external_url' (which ive added) and is in the same database as 'image' (right near the beginning of the query (p.image)) ive tried adding p.external_url after p.image but i couldnt retreive the data. the code that populates variables with the data retreived is: if ($query->num_rows) { return array( 'product_id' => $query->row['product_id'], 'name' => $query->row['name'], 'description' => $query->row['description'], 'meta_description' => $query->row['meta_description'], 'meta_keyword' => $query->row['meta_keyword'], 'tag' => $query->row['tag'], 'model' => $query->row['model'], 'sku' => $query->row['sku'], 'upc' => $query->row['upc'], 'ean' => $query->row['ean'], 'jan' => $query->row['jan'], 'isbn' => $query->row['isbn'], 'mpn' => $query->row['mpn'], 'location' => $query->row['location'], 'quantity' => $query->row['quantity'], 'stock_status' => $query->row['stock_status'], 'image' => $query->row['image'], 'manufacturer_id' => $query->row['manufacturer_id'], 'manufacturer' => $query->row['manufacturer'], 'price' => ($query->row['discount'] ? $query->row['discount'] : $query->row['price']), 'special' => $query->row['special'], 'reward' => $query->row['reward'], 'points' => $query->row['points'], 'tax_class_id' => $query->row['tax_class_id'], 'date_available' => $query->row['date_available'], 'weight' => $query->row['weight'], 'weight_class_id' => $query->row['weight_class_id'], 'length' => $query->row['length'], 'width' => $query->row['width'], 'height' => $query->row['height'], 'length_class_id' => $query->row['length_class_id'], 'subtract' => $query->row['subtract'], 'rating' => round($query->row['rating']), 'reviews' => $query->row['reviews'] ? $query->row['reviews'] : 0, 'minimum' => $query->row['minimum'], 'sort_order' => $query->row['sort_order'], 'status' => $query->row['status'], 'date_added' => $query->row['date_added'], 'date_modified' => $query->row['date_modified'], 'viewed' => $query->row['viewed'] ); } again, i tried adding a line after 'image', but again without any results. any help? thanks
  3. i understand. my issue was that in thinking that the 404.php page would show up, in place of a nonexistent, typed-in url (by a user), and seeing that the 404.php file needs to include elements found across the folder tree, that i would need to target them using the full path. while this is correct, it is incorrect to think the nonexistent url would stay the same while the 404.php would be shown. i don't know why i was thinking that that is how it worked, but you see my logic in needing to use the full path, and why i brought htaccess into the picture. if a file is not found, show the custom 404.php error page. from the 404.php page, include another file to use elements found in different areas of the tree. and to target them from different locations where the 404.php would be shown, i'd need the full url. hehe so, it turns out that the htaccess redirect when a page is not found actually redirects the url to the custom 404.php page instead of 'moving' the 404 file to the current location the user is. HENCE, liking to automatically set the root of the website to where the htaccess file is. Seeing htaccess is complicated as chinese algebra and a little bit of Dead Space moon talk, i decided to hardcode the website's root folder in the htaccess file and remember that the custom 404.php error page does not move places in the tree folder, hence, not needing to use ful url's to include other folders from the server tree, as well. and that is a wrap. this is what you get when you start building something in which you are a tad bit buried into too much of what you don't know, backed up with alot of what you'd like that and taking long breaks while doing so! cheers!
  4. i am trying to work with htaccess! trying to figure out how it works still - i thought i would need to use the full address but im more confused now that before lol i thought the 404 custom error page would keep the original url the user typed in (the failed url, hence the 4040 error) so the 404 error page would need to target elements scattered across the folder tree. thus the need for the include with full url. btw, regarding htaccess, does anybody know if it is at all possible to automatically make the folder in which the htaccess is, the root folder? i read alot of people using hardcoded url to set their base folders but i would like to have this automated if possible.
  5. yep, allow_url_include is off. also didnt see that bit of info on php manual site. anyway, i dont wanna need to mess with ini settings for this one. ill have to go around using the full address. thanks!
  6. oh. didn't read that on the php manual website! thanks!
  7. hi guys so im trying to access a variable from an included php file, included using a full address, with http://www... but its not working. i read up on php manual but i dont get the answers im using php 5.3 path is correct allow url is on included file is inclosed with php tags... could i get some help? here is the simple code i am using // included.php <?php $a = "data"; ?> // main.php <?php include "http://www.somedomain.com/included.php"; echo $a; // outputs nothing ?> what gives? gracias
  8. hi yall how can i escape php variables inside a html attribute, being echoed with php? like follows: echo "<img title=' " . $ls_cb_title . " '>";
  9. follow up thought: so i should always require a minimal mysql version as the latest possible to be able to install an app i create [on a server] - this way i can prevent code breaking. for instance in mysql 4.1 varchar had a limit of 255 characters. in versions after that it changed to 65k. image this being the other way around. if i always require the latest version of mysql to be used, i can prevent any code-breaking changes when installing the app in a server with a newer mysql version. i hope im not overthinking this but it makes sense, right?
  10. just went through the release note in a series of many MySQL versions existent between the one i currently use and the most recent ones. i have a follow up question: does MySQL work the same on Linux and on Windows? i ask this because i saw that i needed a different version requirement to run something, on Windows and Linux. what a mess
  11. thanks its good to know there might not be many code breaking changes very often. good to hear cheers
  12. thanks. thanks. i wasn't sure. besides my lack of reading, the v 4.1 manual doesn't make that emphasis. regards
×
×
  • 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.