I'm currently building a retail e-shop for a jewellery manufacturer which also sells wholesale to other shops and I'm looking for an efficient way to "hide"/"camouflage" the product id's for all products so that other competitors wont be able to see the product's barcodes and find out that the manufacturer is doing direct sales at lower prices.
All products on the website have a 4-5 digit id which is also the name of the products' images, ie for Product #1234 image filename is 1234.jpg
One thought was to add a 3-digit random int before and after the product ID that would make it quite hard for someone to figure out the product id. Another thought would be to reverse the id's or perform some sort of scrambling. This would work fine for all the links within the site and all i'd have to do would be to strip off the first and last 3 digits off the product id's or de-scramble before using in the queries but what can I do when it comes to displaying product images? I don't want visitors to be able to see the filenames, that would completely blow the cover for a ll product id's.
Suggestions and ideas are very welcome.
You shouldn't allow direct access to your images like that. Instead, use a php wrapper which translates your fake product id to the actual image file and return that.
Ie http://.../getimage.php?fakeid=1337 which translates that into the actual product id 123 and then readfile("/path/to/123.png");
The products don't need to be identified by barcode - you could use a meaningless identifier for the products, and only look up the barcode when you actually need it. Example:
product_barcode | product_identifier
7310791268002 | deadbeef01234cafe
Then, you'd use deadbeef01234cafe both for identifying the product in the store, and for the image name.
Related
I have a WooCommerce store and there are basically 2 categories. 1. Diamonds and 2. Engagement Rings
The category Engagement Rings have only 5 products which are Variable Products
I am importing Diamond Category Products from API and they are simple products. There is no any issue in this process. But it has a feature that sets all other products out of stock which are not in that API response.
I want to set something like Category Engagement Ring product should never get Out of Stock.
Is there any possibility I can achieve that?
I know this question can get downvotes as it is not logical enough. But to save time I want to implement this as a temporary fix. and then I am going to make the procedure fully responsible for this kind of stuff.
i have a huge product table, this is its simplified structure:
ID|SHOP|...|MPN|PRICE|CLICKS
i can have the same product coming from different shops, every shop have its own product ID, but (if the shop support it) the MPN for same products is the same.
when i query the database for products, order them by clicks, and if there is the same product from multiple source it is showed twice.
Since im ordered by clicks, the two "equal products" can be far from each other, so its quiete intensive to elaborate it at runtime (consider also the result are paginated and the two equals could be in differente pages).
i was thinking about a query that (if there are multiple result of the same mpn) duplicate some columns as needed (but them how my software can know about the dynamically created columns), i was thinking about SELF JOIN but i don't know how many shop can carry the same product (maybe i can assume all the shop i use...)
My main problem is in search (or category) result where i have a list of products with the "BUY AT SHOP FOR PRICE" button that redirect to the shop... my goal is to have more button to BUY if the product (equal by MPN) have duplicate.
I can keep clicks aligned for both product when a user click on the buy button and maybe it would help
Product detail page is not a big deal, since i have a single product i can get all other instances of it by MPN and it is quiete easy
Any suggestion?
to clarify a bit more i just added this:
https://www.db-fiddle.com/f/61MMDBX4aRqtUFcwVk7Ujw/5#&togetherjs=oO3r8FlaAJ
it shows a simplified versione of my database structure (at the moment products with same MPN can have different click number, but i can keep them in sync)
this is a sample of frontend
https://www.puredesign.it/catalog/male-Scarpe/
my goal is to have multiple "ACQUISTA SU" button if the product can be found in more shop (i.e. same MPN on different product)
There are many different answers to satisfy different online store needs.
A lot of the example I see don’t take into consideration **inventory and images ** and treat styles and sizes as attribute like tags and try to be flexible. This seems wrong to me. My Product that hasMany styles/color that hasMany Sizes.
Here is how i want to layout it out
Product
id | name | price
1 | shirt | 10.00
^ Styles < Images
id product_id name id styles_id filename
1 1 red 1 1 image.jpg
2 1 blue
^ Size
id sku styles_id name inventory
1 n1 1 m 50
2 n2 1 l 50
I don’t see many examples of this but this is what makes sense most to me. Am i totally wrong and bad to do it this way? With styles having its own table I can use a FK with images to load different looks of each style
I know one flaw is that what if I have a product that has only one style and one size. Like a winter coat. Then I to use extra tables. Visually with PHP I will just make it all one form. Will I run into an issue when i start working on cart and orders?
Note: I am using CakePHP
Response to the parent child method
Yes I have seen that before, Wouldn't you have repeated fields or empty fields, for example your table would look like this
id role color size inventory price name
1 parent - - - - artShirt
2 child red m 20 50.00 -
3 child red l 20 50.00 -
4 child blue s 20 50.00 -
5 child blue m 20 50.00 -
how would you link img to products that are red?
id product_id image
1 2 redImg.jpg
1 3 redImg.jpg
the concept i really like is called Parent Product - Child Products.
The Parent Product is given a sku for reference, but its not a buyable product. It represents the product, like the ArtSir Shirt. It contains a product description for ArtSir Shirt, qualities, keywords, etc.
the Child Products are the actual buyable products. the shirts. there is one record per child product with the sku, color, size, price, weight, inventory, etc. they are related to the Parent product by the parent product sku. for most merchants inventory is critical so having a db record per sku is really the only practical way to do this. (not to mention if you need distinct UPC or EAN codes)
the parent products and the child products can all be in - one simple happy db table. like a family :-) You call the parent product with its sku, then get the child products with the parent product sku.
and then when you get the child products, you have the option to filter out the ones with no inventory and not show them.
Showing product pictures on a product page for specific colors -- so this has nothing to do with the products being buyable or not. this is the presentation. the simplest (hack) is to put that information in the Parent product record. fields for Color 1, photo link, Color 2, photo link, etc
Otherwise you could have a separate db table to do this. Just try and confine its tasks to the presentation.
Always pass a product id to the cart - then the cart looks up the product price in the product table. If you pass the product price openly, then it can be easily hacked. When you look up the price you can also confirm inventory.
Suggest that there be one step before billing - where you check price and inventory again to confirm everything is correct before charging the customer.
==============
edit in response to question. you asked:
"Wouldn't you have repeated fields or empty fields, for example your table would look like this"
yes you will have empty fields. in 1985 or 1995 that was important. its not important any longer unless you are running your web site on a machine from that era.
bottom line you have to be able look up a sku and get the price and inventory. you could put arrays or data structures into a field.
but then you are having to pack and unpack them every single time you make a db call.
how would you link img to products that are red?
you can hack it by creating fields for the parent product to hold the image links, a color reference, a name, etc. color01, photolink01,color02, photolink02, etc. its a hack but it will work.
remember you are pulling all the page display information from the parent product. so this is just more display data.
you also have the option of having a photo field in the child product record. which you might need for product feeds. so then you could take the color - photo results from the child products, and use that to create the display.
otherwise make a db table for the display. and that table could also help with uploading the product photos and assigning them to the correct product.
I was wondering if anybody has ever tried to mass import custom attributes into a Magento Database before? My client has a Magento store that specialises in selling musical instruments, and wishes to add a Google Shopping Feed (using the extension of that name by Rocket Web) to sell the products on Google Shopping. The problem is that i need both an MPN (Manufacturer Product Number) and a Brand (so for instance Gibson) for the shopping feed to work, both of which are not automatically uploaded by the stores POS system.
The way that the POS system currently works is when a product is added, the title / SKU number / description / price etc are all uploaded to the Magento store, which means the client does not need to add the product twice. The problem is that as MPN and Brand aren't necessarily out of the box attributes, the POS system does not upload either of these to Magento, and therefore I now have 1,000 products without them and they are apparently crucial to the Google Shopping Feed extension.
I'm currently working on getting a table of each of the products SKU, MPN and Brands from the local database of the POS system (of which each of the products has all 3), but once i have it my question is this: is there a simple way for me to reference the products currently in the Magento database (most likely by SKU, as both databases contain the same SKU for each of the items) and apply two custom fields to each of the products: MPN and Brand? I've created custom 'MPN' and 'cat-brand' attributes (which i can use the Google Shopping Feed to map to the custom attributes) and looked inside the Magento database but i cant find them anywhere, but i found a table called 'catalog_product_flat_1', which i imagine is a flat DB used for indexing or something, but it looks perfect for achieving what i want, in that i could easily search for SKU and apply two custom attributes as columns for each product. Something tells me it isn't going to be that easy though.
Any thoughts would be a great help, thanks for your time.
Magento uses an EAV data model, which means your attributes are broken up into multiple tables. Take a look at any tables with 'entity', 'eav', 'attribute', or 'value' in their name if you want an idea of how it all works.
What you're probably looking for is catalog_product_entity_varchar or catalog_product_entity_text. In those tables, entity_id is your product ID number (different from SKU, but you can link a product_id to a SKU) and attribute_id corresponds to the eav_attribute table.
In short, what you want to do is look at your eav_attribute table, pull the entity_type_id, attribute_id fields for your MPN and cat-brand attributes you made, and then you can insert your data into catalog_product_entity_varchar. (or _text if your attributes use that instead)
In a normalized database schema, the manufacturers would have their own attributes like, for example, name, description, address, phone number.
The manufacturer description is something that is useful for the product pages. Many ecommerce sites show a manufacturer description on every product page.
As far as I know, in Magento you would have to create a product attribute, "Manufacturer description" or something like that. If, for example, ABC Corporation has 1,000 products, you would have to update all 1,000 every time you changed your description for ABC Corporation.
Is that the only reasonably easy way to do it?
Or is there a more database normal way of doing it, where a single, atomic update would result in all the manufacturer's items showing an updated value on the front end?
Create a module with the following contents:
setup script that creates a manufacturer table like desired
model and resource model classes for manufacturer
grid to manage the manufacturers (this is quite complicated, you should follow a tutorial like this or copy the basics from another module)
manufacturer block and template to render HTML for manufacturer info. You will use it as frontend model for the manufacturer_id attribute (see below)
setup script that adds a product attribute manufacturer_id
source model for the manufacturer id, so you can select the manufacturer from a dropdown instead of typing in the id
To display manufacturer description on product page without using product attribute you need to create new table "manufacturer_info" and this table contains information of manufacturer id as well as description.
Table is something like this
manufacturer_id | description
To add description, you need to create new module which will display all the shop brand s and description in grid. When you edit manufacture one form will appear and in that form add description and save it to database.
After saving description, You can display it on product page based on manufacture_id.
To get current manufacture use following code
$_product = $this->getProduct();
$manufacturerName = $_product->getAttributeText('manufacturer');
$manufacturerId = $_product->getManufacturer();
Use manufacturer_id for getting description from newly created table
I hope this helps.