Suggest to improve page load speed - php

I've planned a custom product page in my Magento shop.
I'll try to explain as best as I can.
When you are in the product list page and you clic on the product that is a configurable product the system goes to set the availability of the single product of the configurable in real time.
First of all you must know that the system manages two differents types of availability that depends in what wharehouse the product is stored.
So, when you go in the configurable product the system check the availability in the first wharehouse and if is not, it goes to parse a web page that contains the availability of the product in the second wharehouse.
I've made a mysql table in the db called 'index' that contains the sku of single products and the relative url of the page to parse to get the real time availability.
Obviusly I haven't the access to the db of the second wharehouse.
Now, it works fine but as you can imaginate the load time is too long.
What's your suggest to improve my web pages?

What I can see it, when multiple users will be going on your website, each time there will be a server level hit to external wharehouse page. This is going to be very much complicated and lot of dependency on the speed and execution of wharehouse's page.
Magento provides Soap API of its own. Any external soap user, if given privileges, can send us the soap request to update the product information.
You can create product attributes you want to check for availability in magento. Ask the wharehouse team to send the automated soap requests to magento whenever any availability is changed for any product.
I have been through this where there is a dependency of other party to check for product availability. Hitting their page everytime is really very much dependent and risky.
I have followed SOAP approach now and everything is peaceful. :)

Related

No traces of a user's shopping website until user reopens shop?

I have a friend that found one more problem with the shopping website, her StackOverflow account (Displayed ID name is Ruth) has been used to ask a question for something else today and could not ask another one until two days later. So I have decided to ask the question for my friend.
She is creating a shopping website that allows users to create an account and open a website. If they choose to close down the shop, there is a button for it. So far on the database table, there is a disabled field for the shop, so that the user can reopen the shop again, so she's not completely deleting the shop from the table. But she wants the users not be able to find the information and items of that closed website. So basically no traces of the website is there until the shop owner opens it back up again.
How to make it so that others are not able to find any traces of the website and its items all at once?
It's simple, you add a flag in the database table for example Enabled (boolean) and depending on the condition you fetch the data accordingly.
In your php file, you can fetch the result of the shop from MySQL and if the shop enabled is false, you display a page saying that it's not reachable otherwise you display the shop.
Depends on your application's logic.
Do you have the "disabled" field on a user or shop table? I think it would be easier to implement it on a shop table, that way your shop is set to disabled more clearly.
In this case, I do not think having no traces of the shopping website is even accurate to put. Are you fetching data from a get variable to show the items of that shop? Okay, maybe the ID of that item still exists, because you need it to exist if you still have the table and all the shop items not deleted. What you can do is set up an if statement when the page receives the get variable to display that item. This statement tests whether the item's shop is disabled or not, and this you would need MySQL to help. So when it is disabled, just redirect them to a 404 page or an error page of your customization.
Now, when you do go looking for that shop's website, that should also redirect to a page saying that the shop is not existing. Although this practice is not entirely the best (in terms of security), it may very much be what you are looking for.

Prestashop sharing product stock between two seperate prestashop websites

I have a two seperate websites(f.e. abc.com and 123.com) Shops have the same products, but different prices. I want that these two stores would share product stock and nothing more. So I guess it's just one column from database. Is there a good way to synchronize product stock between two seperate prestashop websites?
In order to achieve your goal. You should use the multistore functionality in Prestashop (sharing products and stock), see doc.prestashop.com/display/PS16/Managing+Multiple+Shops
As I assume you aren't using it for a specific reason, you would need to go and create your own module. Your module should register to the actionUpdateQuantity hook, meaning everytime your stock changes, it should do something, namely send a message to the other shop.
Normally, you would use the Prestashop webservice for this kind of behaviour, but as the webservice has some problems with stock management (see http://forge.prestashop.com/browse/PSCSX-3170, mainly having to do with the advanced stock management). I don't know if you use the ASM functionality, but I've created an example module for syncing your stocks. It can be adapted to be compatible with ASM functionality.
In the module configuration, you'll find the Sync URL of the current shop, you can use that URL in the other shop. So you'll install the module on both shops and cross reference them. I've created a separate sync.php file which will be called to sync the stock. As said, normally you should use the webservice functionality for this (and if you dont use ASM, you can adapt it to use the webservice, if you do use ASM, you must adapt it to allow for stock movements and valuation).
For the code, see the repository at https://github.com/mwienk/prestashop-syncstock

Accept product feed into magento via api (XML)

Is it possible to receive a product feed via external api? I've looked at the magento api and I can see how to produce an XML web service to feed products out, but I need to feed information into magento.
I have a supplier of products with an XML api (SOAP). Is it possible to connect my magento store to this api?
Magento by default does not support this and in my honest opinion I would not go down the route of doing this with magento. The best way I can see of doing this is the following;
1) Create a custom module with a cron config and model (http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job).
2) In the model you created and the method you defined in the module config, load your data feed and loop through the items. Either create them in magento if they don't exist or update/enable/disable/remove the product in magento if they do.
You can schedule the cron to run every few hours or more frequently if it's quick enough, well optimised and not too intensive. You can get clever and possibly have ajax stock check on product view page to give live stock on the product page. Or to ensure it is is in stock at time of order you could add an event observer for the checkout_cart_product_add_before and query the live stock to check it's actually there (but you need to create the event - magento did not create it Magento checkout_cart_product_add_before and get number of products added).
This will essentially allow you to keep magento working normally without extensively extending and overriding the core files. You could of course have a separate app altogether (maybe java) which does the same via magento's SOAP API and the the third party api.

Magento - How to set a per day inventory for an item

First post on stack overflow! Here we go…
OK, so I have Magento community edition v1.5.1.0 setup on my server and have a single product all ready to go. The product has a date attribute which is the date the customer would like the product delivered. The product is an item that I make when a customer orders it. There are only so many of this product that I can physically make a day. So my question is, how do I keep track of the total orders that have been set for delivery on a certain date and disable that date from being selected on the front end when the cap has been met.
I've tried looking for plugins but haven't found anything that suits this situation yet. Any advice/pointers would be great.
I'm quite happy to start prodding at the internal code if need be. Just wanted to make sure I wasn't missing an easy option before diving in!
Thanks in advance
Justyn
Yes this is quite an unusual module and I can understand why there is no pre made plugin yet.
First of all - don't prod the internal code!!! You must extend the platform by writing a custom module, otherwise your application will not be future proof.
Here is a quick plan of attack to show you some Magento techniques for achieving your aim.
Add an attribute to the products which you wish to have this constraint apply to, "delivery_date_capacity"
Create a custom module which listens for orders and stores a record of product and date to be delivered, as well as the threshold orders per delivery day, which is fired when product has the identifying attribute in( "delivery_date_capacity" ).
Depending on the user experience you require, (when the daily threshold is met), when customer clicks "Add to Cart" the module could redirect with a message saying this delivery date is not available, and suggest ones which are close to it before and after.
You may wish to add reverse functionality to automatically add capacity if orders are cancelled. Add an observer which is fired when a product is loaded in the admin which checks if the product availability should be checked again by referencing "delivery_date_capacity" attribute, when an order is cancelled.
You could also load a calendar which show the available dates to reduce the click rate of user, especially if you anticipate suggested dates not being easy for a customer to choose.

php and interspire grab information from dropshipper

I need to grab information from my dropshipper's site. The only thing I really need to grab is the inventory count. What would be the best technique for doing this with php? Should I use cURL? If so, can you please give me some example code of how to do it?
P.S. I am using interspire shopping cart too
Thanks in advance
It's tough to answer without knowing what your dropshipper allows. Mine gave me a detailed user guide with several ways to get data from their servers (cURL, Ruby, PHP, Perl, etc. all with example code).
The way I handled real time stock levels was to build code from one of their examples and using XML-RPC grab the stock levels from the supplier when a customer navigates to the individual product pages. The response from the supplier's server is just the stock number for that product (based on the SKU). My code then inserts that stock level into the prodcurrentinv field in the database for that particular product. This all happens in a split second before the page loads fully (before the stock level display on the page). I added it as a function in class.product.php.
Because I don't really know PHP, I wasn't able to get this to work with more than one SKU at a time (for use in the shopping cart and on the category product listing pages). I'm hiring a programmer for that.
But it's really important to know what type of interaction your supplier allows and it's hard to answer your question without knowing that.

Categories